定义搜索字段(如站点搜索或 Google 搜索):
<label for="gsearch">Search Google:</label> <input type="search" id="gsearch" name="gsearch">
<input type="search">
定义了一个用于输入搜索字符串的文本字段。
注意: 记得给搜索字段设置一个名字,否则什么都不会提交。 搜索输入最常用的名称是 q。
提示: 始终添加 <label>
标签以获得最佳可访问性实践!
表中的数字指定了完全支持该元素的第一个浏览器版本。
Attribute | |||||
---|---|---|---|---|---|
type="search" | 26.0 | 10.0 | 4.0 | 5.1 | 12.1 |
<input type="search">