Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove :hover color from text without setting the color

Tags:

css

hover

I would like to remove the :hover color from the text. However, knowing what the non-hover color is not possible in this case. Is there a way to set the color to inherit from its non :hover parent self? I can see and modify the element:hover CSS but not the element CSS.

Clarification: I want the link to inherit the color from its non-hovered state so that hovering does not have an effect on the element's color. I encapsulated a div in a link so that the entire div would be a link, but I don't want that to change the text's color inside the div. I am changing the background color instead.

like image 412
michaellindahl Avatar asked Nov 03 '22 11:11

michaellindahl


1 Answers

You cannot. There is no undo in CSS. That is, if some style sheet assigns a property to an element, or to a state of an element, there is no way to tell a browser behave as if that rule were not there. You can override its effect, but this means setting the property to a value (which could be inherit, but that won’t help here, since inheritance is from a parent).

like image 71
Jukka K. Korpela Avatar answered Nov 15 '22 06:11

Jukka K. Korpela