It’s based on IDs
, classes
and tags
. IDs
have the highest specificity, then classes
then tags
, so:
.item a == 0 1 1 0 (id) 1 (class=item) 1 (tag=a)
.special == 0 1 0
#foo == 1 0 0
#foo .bar a == 1 1 1
#foo #bar == 2 0 0
whichever has the most wins 🙂 If it’s a tie, whichever one comes last in the document wins. Note that 1 0 0
beats 0 1000 1000
If you want .special
to apply, make it more specific: .item a.special