any-hover CSS media feature can be used to test whether any available input mechanism can hover over elements.

句法

any-hover feature is specified as a keyword value chosen from the list below.

none

None of the available input mechanism(s) can hover conveniently, or there is no pointing input mechanism.

hover

One or more available input mechanisms can conveniently hover over elements.

范例

Testing whether input methods can hover

HTML

<a href="#">Try hovering over me!</a>
					

CSS

@media (any-hover: hover) {
  a:hover {
    background: yellow;
  }
}
					

结果

规范

规范 状态 注释
Media Queries Level 4
The definition of 'any-hover' in that specification.
候选推荐 初始定义。

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
any-hover media feature Chrome 完整支持 41 Edge 完整支持 16 Firefox 完整支持 64 IE 不支持 No Opera 完整支持 28 Safari 完整支持 9 WebView Android 完整支持 41 Chrome Android 完整支持 41 Firefox Android 完整支持 64 Opera Android 完整支持 28 Safari iOS 完整支持 9 Samsung Internet Android 完整支持 5.0

图例

完整支持

完整支持

不支持

不支持

另请参阅

元数据

  • 最后修改: