HTML & CSS · Middle · Question 1 of 75

What is the specificity of the selector nav#main .item:hover > a::before?

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.

Further reading

Problem with a question

HTML & CSS · Middle · question 1

Test yourself

Take the HTML & CSS · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz