I want to change the color of anchor tags of a certain class, but only when they are not hovered. Hovered anchors of the same class should retain the color of unclassed anchors (whatever the other stylesheets have done to them).
For example, given:
a {color: [unknown color];} /* set elsewhere, out of my control */
a.incognito {color:inherit} /* the text color, typically black */
a.incognito:hover {color: [what?];} /* the color of a non-incognito anchor */
Is there a CSS-only solution to have the hovered link not use the color style of the unhovered link of the same class?
You can use the CSS3 :not()
modifier:
a.incognito:not(:hover) {color:inherit} /* the text color, typically black */
Note that this is not supported by IE <= 8.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With