1
下面的代码:我怎样才能有多个选择器混合?
.positionBase (@name,@size: 16px,@position: 0) {
[disabled] [email protected]{name}, .disabled [email protected]{name}, [email protected]{name} {
background-position: @position*@size [email protected];
}
[email protected]{name} {
background-position: @position*@size 0;
}
[email protected]{name}.dark {
background-position: @position*@size -2*@size;
}
[email protected]{name}.dark:hover, a:hover [email protected]{name}.dark, button:hover [email protected]{name}.dark, .button:hover [email protected]{name}.dark, .interactable:hover [email protected]{name}.dark {
background-position: @position*@size -3*@size;
}
}
* {
.positionBase(testing,16px,0)
}
产生如我所期望的:
* [disabled] .icon.testing,
* .disabled .icon.testing,
* .disabled.icon.testing {
background-position: 0px -16px;
}
* .icon.testing {
background-position: 0px 0;
}
* .icon.testing.dark {
background-position: 0px -32px;
}
* .icon.testing.dark:hover,
* a:hover .icon.testing.dark,
* button:hover .icon.testing.dark,
* .button:hover .icon.testing.dark,
* .interactable:hover .icon.testing.dark {
background-position: 0px -48px;
}
如何摆脱*
前缀,只是有选择不带前缀?
东西不起作用:
.positionBase(testing,16px,0)
* {
.positionBase(testing,16px,0)
}
和
{
.positionBase(testing,16px,0)
}
我的谷歌foo是弱,我发现没有什么会让我认为这是可能的,在这种情况下,我想使用*
前缀,但这对性能也非常不利。有任何想法吗?
感谢
党吧!只要SO让我接受这一点,我会......谢谢 – Nate
所以显然你不需要在EVERY线后的半色,只是在支架集中的线或独立线......道德:总是使用分号。 – Nate
*总是使用分号*是遵循非常好的生活格言 –