← All lessons

Lesson 6 · HTML

Forms & Inputs

~20 min

1. Form basics

<form action="/signup" method="post">
  <label for="email">Email</label>
  <input type="email" id="email" name="email" required placeholder="you@example.com">

  <label for="pwd">Password</label>
  <input type="password" id="pwd" name="pwd" required minlength="8">

  <button type="submit">Create account</button>
</form>

Every input needs a <label for="id"> — clicking the label focuses the input (accessibility). required blocks empty submits.

2. Input types

  • text, email, password, number, date, tel, url, search
  • textarea for multi-line, select for dropdown, checkbox/radio for choices

Use correct type — mobile shows right keyboard (email → @, tel → numbers).

Interactive Practice

Practice: Forms & Inputs

Try the examples in your editor and check off when done.

0% complete
Check when done
Quiz

Test Your Understanding

1. Why pair <label> with input?

2. Which validates email format?