HTML Input Types

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

✍️ 3 exercises + code challenge in this lesson

The type attribute changes how an <input> looks and behaves. Modern browsers show special keyboards and pickers for many types.

  • text, password, email, tel, url, search
  • number and range
  • date, time, datetime-local, month, week
  • checkbox and radio
  • color and file
  • submit, reset and button
Radio buttons with the same name form a group: only one can be selected.

Key Takeaways: HTML Input Types

Mastering HTML Input Types helps you write clean and reliable HTML code. Follow standard conventions, test edge cases, and keep logic simple. Try running the code example below and complete the exercises to build confidence.

HTML Input Types Code Example

HTML
<form>
  <input type="email" placeholder="Email"><br><br>
  <input type="password" placeholder="Password"><br><br>
  <input type="number" min="1" max="10" value="5">
  <input type="range" min="0" max="100"><br><br>
  <input type="date"> <input type="time"><br><br>
  <input type="color" value="#2563EB"><br><br>
  <label><input type="checkbox" checked> Subscribe</label><br>
  <label><input type="radio" name="level" checked> Beginner</label>
  <label><input type="radio" name="level"> Advanced</label><br><br>
  <input type="file">
</form>
Free sign-in required · Google login available

HTML Input Types Practice Exercises

Check what you learned in “HTML Input Types”.

/ 3 solved
Fill in the blank

Create an input for email addresses.

<input type="" name="email">
✓ Correct! Not quite. Try again.
Multiple choice

Radio buttons in the same group share the same…

✓ Correct! Not quite. Try again.
Code challenge

Add a checkbox named "terms" that is checked by default.

Write the code in the live editor. Your answer is checked automatically.

Free sign-in required · Google login available

to save your exercise progress.
Finished this lesson?
Mark it complete to track your progress.

Stuck on something?

Ask the community in the CodesInTech forum.

Need a developer?

Learning on your own is great — and when you need professional help, our team builds custom software, websites and mobile apps for clients worldwide.

Explore Our Services