HTML Essentials

Input Types

Choose controls that match the information requested.

Input types give browsers useful behavior such as date pickers, numeric keyboards, and basic validation.

Important definitions

Input type
A value that selects a control behavior.

Syntax

Use this general pattern as a reference:

HTML
<input type="email" name="email">

Examples

Input Types worked example

EXAMPLE 1
<input type="date" name="start_date">
ResultA browser-supported date control.
Try it yourself

Expected output

A browser-supported date control.

Note

Browser appearance differs across devices.

Tip

Match the type to the data, then validate it on the server.

Common mistakes

  • Using text for every value.
  • Assuming browser validation makes data safe.