Reputation: 34023
I want every :hover to automatically inherit the color defined for respective a
element, if not defined specifically. color:inherit;
doesnt seem to do it, any ideas how to accomplish this?
Upvotes: 7
Views: 13204
Reputation: 723729
color: inherit
tells the a
element to inherit the color from its parent, not its "normal" or "generic" state.
Since :hover
is simply a state of the a
element, if you don't specify a color for a:hover
then it will use whatever color that was already declared for it in, for example, an a
rule. So simply don't specify a color. If there's a different value already set and you want to override it, the only way is to set the same color as given in the a
rule in the original stylesheet.
Upvotes: 18