From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/zh-cn/web/css/@media/any-hover/index.html | 76 +++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 files/zh-cn/web/css/@media/any-hover/index.html (limited to 'files/zh-cn/web/css/@media/any-hover/index.html') diff --git a/files/zh-cn/web/css/@media/any-hover/index.html b/files/zh-cn/web/css/@media/any-hover/index.html new file mode 100644 index 0000000000..195b19371b --- /dev/null +++ b/files/zh-cn/web/css/@media/any-hover/index.html @@ -0,0 +1,76 @@ +--- +title: any-hover +slug: Web/CSS/@media/any-hover +tags: + - '@media' + - CSS + - Reference + - 媒体查询 + - 媒体特性 +translation_of: Web/CSS/@media/any-hover +--- +
{{cssref}}
+ +

any-hover CSS 媒体特性 可以用来测试是否有任意可用的输入机制可以在元素上 hover。

+ +

语法

+ +

any-hover 使用下面列表的值作为关键字。

+ +
+
none
+
可用的输入机制里没有机制可以方便地 hover,或者不存在定点输入机制。
+
hover
+
一个或多个可用的输入机制可以方便地在元素上 hover。
+
+ +

示例

+ +

测试是否有输入机制可以 hover

+ +

HTML

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

CSS

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

结果

+ +

{{EmbedLiveSample("Testing_whether_input_methods_can_hover")}}

+ +

规范

+ + + + + + + + + + + + + + + + +
规范状态备注
{{SpecName('CSS4 Media Queries', '#descdef-media-any-hover', 'any-hover')}}{{Spec2('CSS4 Media Queries')}}Initial definition.
+ +

浏览器兼容性

+ + + +

{{Compat("css.at-rules.media.any-hover")}}

+ +

更多资料

+ + -- cgit v1.2.3-54-g00ecf