输入类型=" text" vs input type =" search"在HTML5中

问题描述:

我是HTML5的新手,开始使用HTML5的新表单输入字段。当我使用表单输入字段时,尤其是< input type =text/> < input type =search /> IMO所有主流浏览器都没有任何差异,包括Safari,Chrome,Firefox和Opera。搜索字段的行为也类似于常规文本字段。

I'm new to HTML5 as begun to work with HTML5's new form input fields. When I'm working with form input fields, especially <input type="text" /> and <input type="search" /> IMO there wasn't any difference in all major browser including Safari, Chrome, Firefox and Opera. And the search field also behaves like a regular text field.

那么, input type =text$ c之间有什么区别? $ c>和在HTML5中输入type =search

< input type =search/> ?

现在,他们之间没有太大的交易 - 也许永远不会有。
然而,重点是让浏览器制作者能够根据需要做一些特殊的事情。

Right now, there isn't a huge deal between them - maybe there never will be. However, the point is to give the browser-makers the ability to do something special with it, if they want.

想想< input type =number> 在手机上,打开数字键盘,或 type =email打开一个特殊版本键盘,@和.com以及其他可用的键盘。

Think about <input type="number"> on cellphones, bringing up number pads, or type="email" bringing up a special version of the keyboard, with @ and .com and the rest available.

在手机上,如果需要,搜索可以调出一个内部搜索小程序。

On a cellphone, search could bring up an internal search applet, if they wanted.

另一方面,它有助于当前开发人员使用css。

On the other side, it helps current devs with css.

input[type=search]:after { content : url("magnifying-glass.gif"); }