HTML/CSSBeginner#html#forms#accessibility

What is the purpose of the <label> element and how should it be associated with inputs?

<label> improves accessibility and usability by making the input's purpose clear and expanding the clickable area. Associate it via the 'for' attribute matching the input's id, or by wrapping the input inside the label.

Example
<label for="email">Email</label>
<input id="email" type="email">

<!-- or wrapping -->
<label>Email <input type="email"></label>

Related Questions

1
HTML/CSSBeginner#html#tables

How do you build a table with a header, body, and footer?

Open
2
HTML/CSSIntermediate#html#tables

How do colspan and rowspan work in tables?

Open
3
HTML/CSSBeginner#html#media

How do you embed audio and video with fallback controls?

Open