Specificity is only relevant when comparing selectors that match the same element. In this case, your two rules match totally different elements: the first rule matches a div
element that contains a class D
(div.D
), while the second rule matches span
elements inside that div.D
. What happens then is that both rules apply, but to different elements, resulting in the font size of the span
being 95% of that of div.D
, which in turn is 100% that of its ancestors. No overruling or overriding of styles takes place.
If you add span
to the first rule, this causes it to match the same span
elements inside div.D
that the second rule also applies to. Only then does specificity come into play: the first rule ends up overriding the second based on counting the class selectors.
Also, .A.B.C
counts as three classes; each class selector counts for itself.