css hover是否可在移动设备上使用?我有一个css hover类,在正常的网络浏览器工作正常,但不适用于移动浏览器。
解决方法
:hover伪类需要一个指向(图形输入)设备,能够区分指向和选择/激活的动作。通常在具有触摸界面的移动设备上,您没有前者,只有后者。还有一些笔接口只允许激活,而不是指向。
The
:hover
pseudo-class applies while the user designates an element (with some pointing device),but does not activate it. For example,a visual user agent could apply this pseudo-class when the cursor (mouse pointer) hovers over a Box generated by the element. User agents not supporting interactive media do not have to support this pseudo-class. Some conforming user agents supporting interactive media may not be able to support this pseudo-class (e.g.,a pen device).—07000
所以,回答你的问题:这取决于设备,但可能没有。而不要依赖它。随着触摸屏设备迅速普及,您将失去整个指向事件。