Home > Web Front-end > H5 Tutorial > body text

HTML5 input元素类型:email及url介绍_html5教程技巧

WBOY
Release: 2016-05-16 15:49:01
Original
2452 people have browsed it

在前面的博文,我们已经讨论了一些HTML5改进的地方,比如placeholder,prefetching以及webStorage,下面我要介绍的是两个新的input元素类型: email和url。让我们跟着代码来看看他们的好处:

语法格式:
新的input type属性,将使用 email 或者 url 来替代text:

复制代码
代码如下:







使用HTML5所特有的pattern属性域,你可以提供一个正则表达式来验证email和url地址的格式,我们将在另一篇文章讨论这个话题。

优点
- 可以定制特殊的css样式,input[type=email]
- 可以定制特殊的css样式,input[type=url]
- 可以做更多的语义定义
- 移动应用适配性:移动浏览器将会为email和url弹出特殊的键盘,不用用户手动切换。

最初我很反感添加多余的input type,但深入思考后我觉得对于提高用户体验是一个很好的举措,你认为呢?
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact [email protected]
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!