Intermediate
HTML & CSS
Q65 / 100
What is the purpose of the <label> element in forms, and how does "for" attribute relate to it?
Correct! Well done.
Incorrect.
The correct answer is B) It provides a caption for a form control; the "for" attribute (matching the input's id) associates the label with that input, so clicking the label focuses/activates the input and screen readers announce the label
B
Correct Answer
It provides a caption for a form control; the "for" attribute (matching the input's id) associates the label with that input, so clicking the label focuses/activates the input and screen readers announce the label
Explanation
Associating a <label> with its input via "for"/"id" improves usability (clicking the label activates the control) and accessibility (screen readers announce the label when the input is focused).
Progress
65/100