HTML 5 brings new input types to supplement the standard text input. Notably:

  • email
  • url
  • number
  • range
  • date
  • search
  • color

If you've dabbled with these input types, you may initially see no value in them. But, here are a few reasons to get comfortable with them and start using them consistently in your web development:

  1. Why not! The don't cause any compatibility issues. If an older browser doesn't recognize the input type, it will default to text.
  2. Validation. Some browsers will force validation on certain input types, such as email.
  3. Mobile Support. Mobile phones such as the iPhone offer alternative keyboards or widgets depending on the input type. For instance, if iPhone recognizes a number input, it will switch to the numeric keyboard.

There are many resources out there that explain these new HTML 5 input types in depth.

Code Example:

<input type="email" name="contact_email" id="contact_email" />

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *