有什么简单的方法可以使:focus&:active表现为:hover吗?
通常我写:
.class a:hover, .class a:active, .class a:focus {...}
但是我只想编写一个:hover规则,而:focus&:active看起来一样
.class a:hover {...}
最佳答案
当前在CSS2/3中没有更好的方法可以做到这一点。
但是,您今天可能想使用cssnext来使用 @custom-selectors
和 :matches()
语法。
使用自定义选择器:
@custom-selector :--enter :hover, :focus, .active;
a:--enter { ... }
与:matches()
a:matches(:hover, :focus, .active) { ... }
关于css - 如何使:focus,:active与:hover相同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32620429/