Skip to content

Commit b4b6f2f

Browse files
committed
Simplify form labels
1 parent a6075cd commit b4b6f2f

1 file changed

Lines changed: 36 additions & 32 deletions

File tree

‎Form-Controls/index.html‎

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,58 +16,62 @@ <h1>Product Pick</h1>
1616
<main>
1717
<form aria-label="T-shirt order form">
1818
<div class="form-group">
19-
<label for="customer-name">Name</label>
20-
<input
21-
id="customer-name"
22-
name="customer-name"
23-
type="text"
24-
pattern=".*\S.*\S.*"
25-
title="Please enter at least two non-space characters."
26-
required
27-
/>
19+
<label>
20+
Name
21+
<input
22+
name="customer-name"
23+
type="text"
24+
pattern=".*\S.*\S.*"
25+
title="Please enter at least two non-space characters."
26+
required
27+
/>
28+
</label>
2829
</div>
2930

3031
<div class="form-group">
31-
<label for="customer-email">Email</label>
32-
<input
33-
id="customer-email"
34-
name="customer-email"
35-
type="email"
36-
required
37-
/>
32+
<label>
33+
Email
34+
<input
35+
name="customer-email"
36+
type="email"
37+
required
38+
/>
39+
</label>
3840
</div>
3941

4042
<fieldset class="form-group">
4143
<legend>Choose a colour</legend>
4244
<div class="radio-group">
43-
<label class="option" for="tshirt-colour-red">
44-
<input id="tshirt-colour-red" name="tshirt-colour" type="radio" value="red" required />
45+
<label class="option">
46+
<input name="tshirt-colour" type="radio" value="red" required />
4547
<span>Red</span>
4648
</label>
4749

48-
<label class="option" for="tshirt-colour-blue">
49-
<input id="tshirt-colour-blue" name="tshirt-colour" type="radio" value="blue" />
50+
<label class="option">
51+
<input name="tshirt-colour" type="radio" value="blue" />
5052
<span>Blue</span>
5153
</label>
5254

53-
<label class="option" for="tshirt-colour-black">
54-
<input id="tshirt-colour-black" name="tshirt-colour" type="radio" value="black" />
55+
<label class="option">
56+
<input name="tshirt-colour" type="radio" value="black" />
5557
<span>Black</span>
5658
</label>
5759
</div>
5860
</fieldset>
5961

6062
<div class="form-group">
61-
<label for="tshirt-size">Choose a size</label>
62-
<select id="tshirt-size" name="tshirt-size" required>
63-
<option value="" selected disabled>Select a size</option>
64-
<option value="XS">XS</option>
65-
<option value="S">S</option>
66-
<option value="M">M</option>
67-
<option value="L">L</option>
68-
<option value="XL">XL</option>
69-
<option value="XXL">XXL</option>
70-
</select>
63+
<label>
64+
Choose a size
65+
<select name="tshirt-size" required>
66+
<option value="" selected disabled>Select a size</option>
67+
<option value="XS">XS</option>
68+
<option value="S">S</option>
69+
<option value="M">M</option>
70+
<option value="L">L</option>
71+
<option value="XL">XL</option>
72+
<option value="XXL">XXL</option>
73+
</select>
74+
</label>
7175
</div>
7276

7377
<button type="submit">Order now</button>

0 commit comments

Comments
 (0)