diff options
Diffstat (limited to 'files/zh-cn/web/html/global_attributes/inputmode/index.html')
| -rw-r--r-- | files/zh-cn/web/html/global_attributes/inputmode/index.html | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/files/zh-cn/web/html/global_attributes/inputmode/index.html b/files/zh-cn/web/html/global_attributes/inputmode/index.html new file mode 100644 index 0000000000..36eb81901a --- /dev/null +++ b/files/zh-cn/web/html/global_attributes/inputmode/index.html @@ -0,0 +1,64 @@ +--- +title: inputmode +slug: Web/HTML/Global_attributes/inputmode +translation_of: Web/HTML/Global_attributes/inputmode +--- +<p><span class="seoSummary"><strong><code>inputmode</code></strong> <a href="/en-US/docs/Web/HTML/Global_attributes">全局属性</a> </span>是一个枚举属性,它提供了用户在编辑元素或其内容时可能输入的数据类型的提示。它可以是以下值:</p> + +<dl> + <dt><code>"none"</code></dt> + <dd>无虚拟键盘。在应用程序或者站点需要实现自己的键盘输入控件时很有用。</dd> + <dt><code>"text"</code></dt> + <dd>使用用户本地区域设置的标准文本输入键盘。</dd> + <dt><code>"decimal"</code></dt> + <dd>小数输入键盘,包含数字和分隔符(通常是“ . ”或者“ , ”),设备可能也可能不显示减号键。</dd> + <dt><code>"numeric"</code></dt> + <dd>数字输入键盘,所需要的就是0到9的数字,设备可能也可能不显示减号键。</dd> + <dt><code>"tel"</code></dt> + <dd>电话输入键盘,包含0到9的数字、星号(*)和井号(#)键。表单输入里面的电话输入通常应该使用 <code><a href="/en-US/docs/Web/HTML/Element/input/tel"><input type="tel"></a></code> 。</dd> + <dt><code>"search"</code></dt> + <dd>为搜索输入优化的虚拟键盘,比如,返回键可能被重新标记为“搜索”,也可能还有其他的优化。</dd> + <dt><code>"email"</code></dt> + <dd>为邮件地址输入优化的虚拟键盘,通常包含"@"符号和其他优化。表单里面的邮件地址输入应该使用 <code><a href="/en-US/docs/Web/HTML/Element/input/email"><input type="email"></a></code> 。</dd> + <dt><code>"url"</code></dt> + <dd>为网址输入优化的虚拟键盘,比如,“/”键会更加明显、历史记录访问等。表单里面的网址输入通常应该使用 <code><a href="/en-US/docs/Web/HTML/Element/input/url"><input type="url"></a></code> 。</dd> +</dl> + +<p>如果没有设置这个属性,它的默认值是 <code>"text"</code>,表明使用本地的标准文本输入键盘。</p> + +<div class="warning"> +<p><strong>规范冲突</strong>: <a href="https://html.spec.whatwg.org/multipage/interaction.html#attr-inputmode">WHATWG(超文本应用技术工作组)规范中列出了 <code>inputmode</code></a>, 并且现代浏览器正在努力支持它。但 <a href="https://www.w3.org/TR/html52/index.html#contents">W3C HTML 5.2 规范</a> 不再将其列出(也就是说将其标记为过时的)。在达成共识之前,你应该认为WHATWG规范定义的就是正确的。</p> +</div> + +<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("HTML WHATWG", "interaction.html#input-modalities:-the-inputmode-attribute", "inputmode")}}</td> + <td>{{Spec2("HTML WHATWG")}}</td> + <td></td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + + + +<p>{{Compat("html.global_attributes.inputmode")}}</p> + +<h2 id="参照">参照</h2> + +<ul> + <li>所有 <a href="/en-US/docs/Web/HTML/Global_attributes">全局属性</a></li> +</ul> + +<div>{{HTMLSidebar("Global_attributes")}}</div> |
