我想改变某个类的 anchor 标签的颜色,但只有当它们没有悬停时。同一类的悬停 anchor 应保留未分类 anchor 的颜色(无论其他样式表对它们做了什么)。
例如,给定:
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 */
是否有纯 CSS 解决方案让悬停链接不使用同一类未悬停链接的颜色样式?
最佳答案
您可以使用 CSS3 :not()
修饰符:
a.incognito:not(:hover) {color:inherit} /* the text color, typically black */
请注意,IE <= 8 不支持此功能。
关于CSS 颜色 anchor ,但不是 A :hover,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16401942/