nalzok
nalzok

Reputation: 16107

Error calculating CSS selector specificity with pseudo-classes

I'm reading a tutorial on MDN, and I encountered the following snippet:

/* weight: 0015 */
div div li:nth-child(2) a:hover {
  border: 10px solid black;
}

My question is: Why this rule's specificity is 0015, rather than 0024?

I think the overall selector contains 2 pseudo-classes selectors(:nth-child(2) and :hover) and 4 element selectors(div, div, li and a), so its specificity should be 0024.

Where am I wrong?

Upvotes: 1

Views: 62

Answers (1)

Quentin
Quentin

Reputation: 943561

You aren't. The example had an error in it but has now been fixed.

Upvotes: 2

Related Questions