Course contentsLesson 5 of 6← Course overview
  1. 01A page is a conversation18 min
  2. 02Give your content structure24 min
  3. 03Make a layout that adapts32 min
  4. 04Make a button do something35 min
  5. 05Make forms easier to use28 min
  6. 06Keep a trail of your work36 min

Web development · Lesson 05

Make forms easier to use

Edit lesson

Build a form with labels, helpful feedback, and a clear success state.

28 minProgress saves on this device
In this lesson
  • Connect labels to form controls
  • Give useful feedback when an entry is missing

Helpful background: Semantic HTML and basic page structure.

A label is part of the control

Every input needs an understandable label. Connecting a label to its input gives the control a name and makes its clickable area easier to use.

Be specific about errors

Tell the learner what needs attention and how to fix it. Don’t rely on color alone: pair it with text, and keep focus near the field that needs action.

Accessible by default

Use native controls when they fit. They already support keyboard interaction and work with assistive technology. Add custom behavior only when it improves the experience.

A labeled inputhtml
<label for="email">Email address</label>
<input id="email" name="email" type="email" required>
<p id="email-help">Use an address you can access.</p>
Knowledge check

What connects this label to its input?

Try first; feedback appears after you check.
Apply it

Your turn

A sign-up form rejects an empty email field. Write a short error message that tells the learner what to do.

Continue readingW3C WAI: Forms labels

BUILT TOGETHER

Help make this explanation better.

Have a clearer explanation, a useful example, or a correction? Share it with the community.

Contributors

Be the first to add your name when you improve this lesson.

How to get credited
Previous lessonNext lesson