HTML5 input element type: email and url Introduction

Source: Internet
Author: User

Comments: You may be aware of the HTML5 improvements. Next I will introduce two new input element types: email and url. Let's take a look at their benefits with the Code. If you are interested, refer to the previous blog post. We have discussed some HTML5 improvements, such as placeholder, prefetching, and webStorage, the following describes two new input element types: email and url. Let's follow the code to see their benefits:

Syntax format:
The new input type attribute replaces text with email or url:

The Code is as follows:
<! -- Email, non-@ + non-@ symbol, you can also use other,
For example, [a-zA-Z0-9] {3, 30} @ [a-zA-Z0-9] + \ w * \. (com | cn | org | net) -->
<Input type = "email" pattern = "[^ @] * @ [^ @] *" value = "">
<! -- Url -->
<Input type = "url" value = "">


Using the pattern attribute field specific to HTML5, you can provide a regular expression to verify the format of the email and url address. We will discuss this topic in another article.

Advantages
-You can customize special css styles. input [type = email]
-You can customize special css styles. input [type = url]
-More semantic definitions can be made.
-Mobile app Adaptability: A special keyboard is displayed for the email and url in the mobile browser. You do not need to switch between them manually.

At first, I was disgusted with adding Redundant input types. But after thinking deeply, I think it is a good way to improve user experience. What do you think?

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.