Accessibility · Junior · Question 25 of 75
How do you correctly connect a label to an input?
<label for="email">Email</label>
<input id="email" type="email" />- 1Like this:
formatches theidof the input - 2It's wrong:
labelhas to come after theinput - 3It's wrong: the input needs
name="label"as well
Show the answer
Correct answer: Like this: for matches the id of the input
Explanation
The label gives the field its accessible name and enlarges the click target. Wrapping the input inside <label> also works.