</> Code Corner

HTML · HTML Forms · Lesson 43

HTML Input Types

text, email, number, date, color, range and more.

The type attribute of <input> decides which kind of control is shown.

Example

<form>
  <input type="email" placeholder="Email"><br><br>
  <input type="number" min="1" max="5" value="3"><br><br>
  <input type="date"><br><br>
  <input type="color" value="#04AA6D"><br><br>
  <input type="range" min="0" max="10"><br><br>
  <input type="checkbox" id="c1"><label for="c1"> I agree</label><br><br>
  <input type="file"><br><br>
  <input type="search" placeholder="Search..."><br><br>
  <input type="url" placeholder="https://"><br><br>
  <input type="tel" placeholder="Phone">
</form>
Type Purpose
text / password Single line text / masked text
email / url / tel Email addresses / web addresses / phone numbers
number / range Numeric value / slider
date / time / datetime-local / month / week Date and time pickers
color Color picker
checkbox / radio Multiple choice / single choice
file File upload
hidden A value not shown to the user

Keep reading “HTML Input Types”

Sign up to read the full lesson, try every example in the live editor, and take the 5-question quiz.

Chat with us 👋