How does CSS specificity decide which styles to apply?
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 … Read more