html - Does the :not pseudo class increase the specificity of a selector? -
i have read on css tricks :not should not add additional specificity. looks does?
https://css-tricks.com/almanac/selectors/n/not/
the specificity of :not pseudo class specificity of argument. :not() pseudo class not add selector specificity, unlike other pseudo-classes.
or missing something?
.red:not(.blue) { background: blue; } .red { height: 100px; width: 100px; background: red; }
<div class="red"> </div>
yes, adds specificity of argument. @ first sentence:
the specificity of :not pseudo class specificity of argument. :not() pseudo class not add selector specificity, unlike other pseudo-classes.
so specificity of .red:not(.blue)
equal of .red.blue
— 2 class selectors, or (0, 2, 0), making more specific .red
on own. second sentence means :not()
itself not contribute additional specificity of pseudo-class make (0, 3, 0), :hover
in .red.blue:hover
example.
Comments
Post a Comment