CSS颜色锚点,但不是A:hover [英] CSS color Anchor, but not A:hover

查看:378
本文介绍了CSS颜色锚点,但不是A:hover的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想更改某个类的锚标签的颜色,但只有当它们不是悬停时。



例如,给定:

  a {color:[unknown color];} / *设置在其他地方,我的控制* / 

a.incognito {color:inherit} / *文本颜色,通常为黑色* /
a.incognito:hover {color:[what?];} / *非隐身锚的颜色* /

是否有 CSS-only 解决方案让悬浮链接不使用颜色样式

您可以使用CSS3 :not()修饰符:

  a.incognito:not(:hover){color:inherit} / *文字颜色,通常为黑色* / 

请注意,IE< = 8不支持。

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.

这篇关于CSS颜色锚点,但不是A:hover的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆