我有3项主要内容:.submit-it
,.send-it
,.get-results
。
我希望它们的所有:after
元素都具有某些样式,除非它们具有类excluded
或error
。我以为这样可以,但是不行。
.submit-it, .send-it, .get-results {
&:not(.excluded), &:not(.error) {
&:after {
content: 'text';
}
}
}
通过生成以下选择器,您实际上在设计所有:after
伪元素的样式,无论其类别如何。
.submit-it:not(.excluded):after,
.submit-it:not(.error):after, { ... }
通过选择所有没有class的元素excluded
和所有没有class的元素error
,您将间接选择所有元素,因为这两个事件不是互斥的。
因此,您将链接:not()
伪类,并替换:
&:not(.excluded), &:not(.error)
和:
&:not(.excluded):not(.error)
.submit-it, .send-it, .get-results {
&:not(.excluded):not(.error) {
&:after {
content: 'text';
}
}
}
将输出:
.submit-it:not(.excluded):not(.error):after,
.send-it:not(.excluded):not(.error):after,
.get-results:not(.excluded):not(.error):after {
content: 'text';
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句