Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can :hover inherit the link color by default

Tags:

html

css

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?

like image 699
Fellow Stranger Avatar asked Aug 17 '13 16:08

Fellow Stranger


1 Answers

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.

like image 142
BoltClock Avatar answered Oct 26 '22 09:10

BoltClock