Search code examples
htmlcsspseudo-classcss-specificity

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?


Solution

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