css hover是否可在移动设备上使用? [英] Does css hover work on mobile devices?
问题描述
css hover是否可在移动设备上使用?我有一个css hover类,它在常规的网络浏览器上正常工作,但在移动浏览器上不起作用。
Does css hover work on mobile devices? I have a css hover class which works fine on a regular web browser, but doesn't work on mobile browsers.
推荐答案
:hover
伪类需要一个指向(图形输入)设备,能够区分指向和选择/激活。 em>通常在具有触摸界面的移动设备上,您没有前者,只有后者。也有一些笔接口只允许激活,而不指向。
The :hover
pseudo-class needs a pointing (graphical input) device, capable of distinguishing the actions pointing and selecting/activating. Usually on mobile devices with a touch interface you don't have the former, only the latter. Also some pen interfaces only allow activating, not pointing.
:hover
pseudo -class适用于用户指定元素(使用某些定位设备),但不激活它。例如,当光标(鼠标指针)悬停在由该元素生成的框上时,可视用户代理可以应用此伪类。不支持交互式媒体的用户代理不必支持此伪类。支持交互式媒体的一些符合的用户代理可能不能支持该伪类(例如,笔设备)。
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).
所以,回答你的问题:这取决于设备,但可能没有。而不要依赖它。随着触摸屏设备的迅速普及,您将失去整个指向事件。
So, to answer your question: It depends on the device but likely no. And don't rely on it. With touch-screen devices quickly gaining in popularity you'll lose the entirety of pointing-only events.
这篇关于css hover是否可在移动设备上使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!