aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/css/@media/any-pointer/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/zh-cn/web/css/@media/any-pointer/index.html')
-rw-r--r--files/zh-cn/web/css/@media/any-pointer/index.html108
1 files changed, 108 insertions, 0 deletions
diff --git a/files/zh-cn/web/css/@media/any-pointer/index.html b/files/zh-cn/web/css/@media/any-pointer/index.html
new file mode 100644
index 0000000000..8d05eb28d4
--- /dev/null
+++ b/files/zh-cn/web/css/@media/any-pointer/index.html
@@ -0,0 +1,108 @@
+---
+title: any-pointer
+slug: Web/CSS/@media/any-pointer
+tags:
+ - '@media'
+ - CSS
+ - Reference
+ - 媒体查询
+ - 媒体特性
+translation_of: Web/CSS/@media/any-pointer
+---
+<div>{{cssref}}</div>
+
+<p><strong><code>any-pointer</code></strong> <a href="/en-US/docs/CSS">CSS</a> <a href="/en-US/docs/Web/CSS/Media_Queries/Using_media_queries#Media_features">媒体特性</a> 测试用户是否拥有<em>任意</em>定点装置(如鼠标)。以及如果存在定点装置,它的精确度是什么样的。</p>
+
+<div class="note">
+<p><strong>注:</strong> 如果你想测试<em>主</em>定点设备的精确度, 使用 <code><a href="/en-US/docs/Web/CSS/@media/pointer">pointer</a></code> 。</p>
+</div>
+
+<h2 id="语法">语法</h2>
+
+<p><code>any-pointer</code> 特性使用下面的关键字。</p>
+
+<dl>
+ <dt><code>none</code></dt>
+ <dd>没有可用的定点设备。</dd>
+ <dt><code>coarse</code></dt>
+ <dd>至少有一个输入途径包含一个精度有限的定点装置。</dd>
+ <dt><code>fine</code></dt>
+ <dd>至少有一个输入途径包含一个精确的定点装置。</dd>
+</dl>
+
+<div class="note">
+<p><strong>注:</strong> 当输入设备拥有不同特性时,可能有多于一个的值被匹配。<code>none</code> 仅当它们都不是定点设备时被匹配。</p>
+</div>
+
+<h2 id="示例">示例</h2>
+
+<p>这个例子为拥有至少一个精确定点装置的用户创建了一个小 checkbox,为拥有至少一个粗略定点装置的用户创建了一个大 checkbox。大 checkbox 的优先级更高,因为它的声明在小 checkbox 的声明后。</p>
+
+<h3 id="HTML">HTML</h3>
+
+<pre class="brush: html notranslate">&lt;input id="test" type="checkbox" /&gt;
+&lt;label for="test"&gt;Look at me!&lt;/label&gt;</pre>
+
+<h3 id="CSS">CSS</h3>
+
+<pre class="brush: css notranslate">input[type="checkbox"]:checked {
+ background: gray;
+}
+
+@media (any-pointer: fine) {
+ input[type="checkbox"] {
+ -moz-appearance: none;
+ -webkit-appearance: none;
+ appearance: none;
+ width: 15px;
+ height: 15px;
+ border: 1px solid blue;
+ }
+}
+
+@media (any-pointer: coarse) {
+ input[type="checkbox"] {
+ -moz-appearance: none;
+ -webkit-appearance: none;
+ appearance: none;
+ width: 30px;
+ height: 30px;
+ border: 2px solid red;
+ }
+}
+</pre>
+
+<h3 id="Result">Result</h3>
+
+<p>{{EmbedLiveSample("Examples")}}</p>
+
+<h2 id="规范">规范</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">规范</th>
+ <th scope="col">状态</th>
+ <th scope="col">备注</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('CSS4 Media Queries', '#descdef-media-any-pointer', 'any-pointer')}}</td>
+ <td>{{Spec2('CSS4 Media Queries')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+
+
+<p>{{Compat("css.at-rules.media.any-pointer")}}</p>
+
+<h2 id="更多资料">更多资料</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/CSS/@media/pointer"><code>pointer</code> media feature</a></li>
+</ul>