HTML Input Types
The <input> tag's type attribute determines what kind of control is rendered and what kind of data it accepts — text, email, password, number, date, checkbox, radio, and many more.
Using the correct semantic input type (like type="email" instead of plain text) provides built-in validation and often triggers better mobile keyboards automatically.
<input type="email" name="email">Common text-like types
type="text" is generic text, type="email" validates email format, type="password" masks characters, and type="number" restricts to numeric input.
Choice-based types
type="checkbox" allows multiple selections, type="radio" allows one choice from a group (grouped by shared name), and type="date" shows a date picker.
<input type="email" name="email" placeholder="you@example.com">(validates as a proper email format on submit)type="email" triggers built-in format validation and mobile email keyboards.
<input type="radio" name="plan" value="basic"> Basic
<input type="radio" name="plan" value="pro"> Pro○ Basic ○ ProRadio buttons sharing the same name allow only one selection at a time.
Key points
- The type attribute defines the input's behavior and validation.
- Common types: text, email, password, number, date, checkbox, radio.
- Semantic types improve validation and mobile keyboard behavior.
- Radio buttons in the same group must share the same name.
