Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
This Labels (label and for) worksheet is part of the HTML and CSS Journey journey. Print it as a booklet?
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1<label for="name">Full name</label> <input type="text" id="name"> | A<label for="pass">Password</label> <input type="password" id="pass"> | |
| 2<label for="agree">I agree</label> <input type="checkbox" id="agree"> | B<label for="email">Email</label> <input type="email" id="email"> | |
| 3The for attribute value must exactly match the input's id - the match is case-sensitive | CAttribute names must be lowercase - 'For' should be written as 'for' | |
| 4Every visible form control should have an associated <label> for accessibility | Dfor and id matching is case-sensitive - for="age" does not match id="AGE" | |
| 5<label For="city">City</label> <input type="text" id="city"> | EThe label is linked to the input - for="name" matches id="name", so clicking the label focuses the input | |
| 6<label for="age">Age</label> <input type="number" id="AGE"> | FClicking the label text also checks or unchecks the checkbox - for/id linking is especially useful for small controls |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
for — The <label> attribute that links the label to a specific input. Its value must exactly match the id of the target input element.<label for="name">Your name</label><label for="email">Email</label><label for="user">User</label>
<input type="text" id="user"><label for="pass">Password</label>
<input type="password" id="pass"><label for="city">City</label>
<input type="text" id="city">