2 ms·
Nesting is not actually more specific. Rather specificity is a triplet of (ids sub-selectors, class sub-selectors, element sub-selectors). When attributes con
by masklinn 3y ago
Nesting is not actually more specific.
Rather specificity is a triplet of (ids sub-selectors, class sub-selectors, element sub-selectors). When attributes conflict, the one whose rule has the more specific selector wins.
The specificities of the rules you wrote out are (1,0,0), (0,1,0), (0,2,0), (0,1,0), (0,1,0), and (0,0,1).
In-line attributes (@style) beat out out-out-of line ones except if they’re !important. Specificity also disambiguates between !important attributes.
- blowski 3y agoThank you for the clarification, I hadn't realised that.