【发布时间】:2016-05-04 11:23:12
【问题描述】:
我已经阅读了 :not 不应该增加额外特异性的 css 技巧。但看起来确实如此?
https://css-tricks.com/almanac/selectors/n/not/
:not 伪类的特殊性是其参数的特殊性。 :not() 伪类不会增加选择器的特异性,不像其他伪类。
还是我错过了什么?
.red:not(.blue) {
background: blue;
}
.red {
height: 100px;
width: 100px;
background: red;
}
<div class="red">
</div>
【问题讨论】:
-
将其与
.blue.red进行比较,.red仍然很重要
标签: html css css-selectors css-specificity