Recall & Review
beginner
What is the purpose of the <label> element in HTML forms?
The <label> element connects text to a form control, making it easier for users to understand what input is expected and improving accessibility.
Click to reveal answer
beginner
How do you associate a <label> with an <input> using the
for attribute?Set the
for attribute on the <label> to match the id of the <input>. This links the label to the input so clicking the label focuses the input.Click to reveal answer
intermediate
Can a <label> wrap an <input> element? How does this affect association?
Yes, wrapping an <input> inside a <label> automatically associates them without needing the
for attribute. Clicking the label focuses the input.Click to reveal answer
beginner
Why is label association important for accessibility?
Screen readers use label associations to read out what input fields are for, helping users with disabilities understand and fill forms correctly.
Click to reveal answer
beginner
What happens if a form input has no associated label?
Users may find it hard to know what to enter, and assistive technologies may not describe the input properly, causing confusion and poor user experience.
Click to reveal answer
Which attribute on the <label> element links it to an <input>?
✗ Incorrect
The
for attribute on What happens when you click on a label associated with a checkbox?
✗ Incorrect
Clicking a label linked to a checkbox toggles the checkbox, improving usability.
Which of these is a valid way to associate a label with an input?
✗ Incorrect
Both wrapping the input inside the label and using the for/id attributes correctly associate the label and input.
Why should every form input have a label?
✗ Incorrect
Labels help users and assistive technologies understand form inputs, improving accessibility and usability.
If a label has
for='email', what must the input have?✗ Incorrect
The input must have
id='email' to link with the label's for attribute.Explain how to properly associate a label with an input in HTML and why it matters.
Think about how clicking the label affects the input.
You got /4 concepts.
Describe the impact on users if form inputs do not have associated labels.
Consider users with disabilities and keyboard navigation.
You got /4 concepts.