CSS specificity or inheritance?

This is due to specificity: although a is an element type selector which is less specific than a class selector, it’s accompanied by a :link pseudo-class which is equally specific to your .button class. A type + pseudo-class will therefore be more specific than a class.

There is no inheritance going on here as there are no parent element styles that I can see being applied to your element. Inheritance refers to adopting styles from parent elements. When you see the link displaying blue instead of white, that’s the cascade at work, not inheritance.

Locality isn’t a CSS term (at least not in its glossary), so I’m not sure what you mean by that.

If you need your call-to-action button to be white, simply give it the a selector as well, so your selectors are equally specific and the last declaration will take precedence:

a:link {font-size:0.875em;color:#005984}
a.button {color:#fff}

Leave a Comment