×

html · level 2 · unit 7 · lesson 4

  1. meet it
  2. guess first
  3. your turn
  4. fix it
  5. nailed it

Tap a green word if you get lost.

meet it

Plan the questions, build the form, then it like a visitor.

A good booking form starts on paper. List what you need to know, and nothing more. Group the questions that belong together, and decide which are required.

Then build it with what you know: a <fieldset> and <legend> for each group, the right input types, a name for every field, limits, help text and a button that says what happens.

Finally, test it by trying to break it. Leave boxes empty, type a wrong email, book for 40 people, use only the Tab key. Every gap you find now is one a visitor never meets.

<form action="https://example.com/book" method="post">
  <fieldset>
    <legend>Your visit</legend>
    <label for="day">Date (required)</label>
    <input type="date" id="day" name="day" required>
    <label for="people">People (1 to 6)</label>
    <input type="number" id="people" name="people" min="1" max="6">
  </fieldset>
  <button>Book my visit</button>
</form>

Press show my page to see it here.

Testing with the keyboard alone shows you what many screen reader users meet.