HTML & CSS · Middle · Question 1 of 75
What is the specificity of the selector nav#main .item:hover > a::before?
- 1(1, 1, 3) - an ID, a class, and
:hoverdoesn't count at all - ✓Correct answer: (1, 2, 3) - an ID, class + pseudo-class, two types + pseudo-element
- 3(0, 3, 3) - an ID inside a compound selector weighs like a class
Explanation
Count by column: IDs - #main (1); classes, attributes and pseudo-classes - .item and :hover (2); types and pseudo-elements - nav, a, ::before (3). Combinators (>, space) add no specificity. A pseudo-class weighs like a class, and a pseudo-element like a type selector.