As I delved into a tutorial on MDN, an intriguing code snippet caught my attention:
/* weight: 0015 */
div div li:nth-child(2) a:hover {
border: 10px solid black;
}
An unanswered question lingers in my mind: Why does this rule's specificity display as 0015 instead of the anticipated 0024?
Ruminating on the matter, I counted 2 pseudo-classes selectors (:nth-child(2)
and :hover
) along with 4 element selectors (div
, div
, li
, and a
). By my calculations, the specificity should total 0024.
Yet doubts persist. Where might I have miscalculated?