CSS color Anchor but not A: hover

I want to change the color of the anchor labels of a particular class, but only when they do not hang. Hinged anchors of the same class should preserve the color of unclassified anchors (regardless of what they did with other styles).

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 prevent the linked link from using the color style for an unclosed link of the same class?

+6
source share
1 answer

You can use the CSS3 :not() modifier:

 a.incognito:not(:hover) {color:inherit} /* the text color, typically black */ 

Please note that this is not supported by IE <= 8.

+10
source

Source: https://habr.com/ru/post/944376/


All Articles