LESSON 18
Labels and Accessibility
Learning objective: Connect labels to inputs so forms are usable by everyone.
Understand
Accessible forms work for keyboard and screen-reader users too.
A <label> names an input. Link them by matching the label's for attribute to the input's id. This lets users click the label to focus the field and lets screen readers announce it. Accessibility is not optional polish — it is part of doing the job right.
Analogy: A label tied to its field is like a name tag firmly attached to the right person.
See It in Action
A properly linked label and input:
<label for="email">Email</label>
<input id="email" type="email">for matches the input's id, so clicking the label focuses the input and assistive tech reads them together.Try It Yourself
- Add
idto an input and matchingforto its label. - Click the label text and confirm the field focuses.
- Check every field in your form has a label.
Quick Quiz
How do you link a label to its input?
Challenge
Make every field in your contact form use a correctly linked label.
Success condition: Clicking any label focuses its matching input.
Lesson Complete
You answered correctly and completed the required practice. Your progress has been saved on this device.
Continue to next lesson →