Ios 移动端伪类不生效
经过一番查找,之后在mozilla开发社区找到了:active不起作用的答案:
[1] By default, Safari Mobile does not use the :active state unless there is a touchstart event handler on the relevant element or on the
1 |
|
将上述事件监听代码加上后,Safari Mobile上就可以看到按钮按下后的切换效果了。
经过一番查找,之后在mozilla开发社区找到了:active不起作用的答案:
[1] By default, Safari Mobile does not use the :active state unless there is a touchstart event handler on the relevant element or on the
1 |
|
将上述事件监听代码加上后,Safari Mobile上就可以看到按钮按下后的切换效果了。
在iOS的 Safari浏览器中默认点击超链接按钮时会有点击态,这个就比较讨厌了。

1 | * { |
通过设置 -webkit-tap-highlight-color 这个私有属性可以去除点击态