Syntax
<label for="email">Email:</label>
<input type="email" id="email">Examples
Label with for Attribute
Explicitly associating a label with an input using matching for/id.
<label for="username">Username:</label>
<input type="text" id="username" name="username">Wrapped Label
Associating a label implicitly by wrapping the input inside it.
<label>
Accept terms and conditions
<input type="checkbox" name="terms">
</label>Styled Label with Input
A label and input styled together as a form field.
<div style="display: flex; flex-direction: column; gap: 4px;">
<label for="pw" style="font-weight: 600; font-size: 14px;">Password</label>
<input type="password" id="pw" style="padding: 8px; border: 1px solid #d1d5db; border-radius: 6px;">
</div>Attributes
- for (string): The id of the form control this label describes
Best practices
- Every form input should have an associated label — never rely on placeholder text alone
- Prefer the explicit for/id association over wrapping, as it is more robust with custom-styled inputs
- Keep label text short and descriptive of exactly what the field expects
- Make sure the for value exactly matches the input's id, including capitalization
Browser compatibility
Support applies to the named feature, not every attribute or behaviour in this article. Versions refer to browsers, not operating systems.
<label>
Desktop
- Chrome
- Supported
From 1 - Firefox
- Supported
From 1 - Safari
- Supported
By 4 (possibly earlier) - Edge
- Supported
From 12 - Opera
- Supported
From 15
Mobile
- Safari on iOS
- Supported
By 3.2 (possibly earlier) - Chrome for Android
- Supported
From 18 - Firefox for Android
- Supported
From 4 - Samsung Internet
- Supported
From 1.0
MDN BCD record for this feature · MDN reference
Support history and limitations
Chrome
- From 1
Firefox
- From 1
Safari
- By 4 (possibly earlier)
Edge
- From 12
Opera
- From 15
Safari on iOS
- By 3.2 (possibly earlier)
Chrome for Android
- From 18
Firefox for Android
- From 4
Samsung Internet
- From 1.0
<label> for
Desktop
- Chrome
- Supported
From 1 - Firefox
- Supported
From 1 - Safari
- Supported
By 4 (possibly earlier) - Edge
- Supported
From 12 - Opera
- Supported
From 15
Mobile
- Safari on iOS
- Supported
By 3.2 (possibly earlier) - Chrome for Android
- Supported
From 18 - Firefox for Android
- Supported
From 4 - Samsung Internet
- Supported
From 1.0
MDN BCD record for this feature · MDN reference
Support history and limitations
Chrome
- From 1
Firefox
- From 1
Safari
- By 4 (possibly earlier)
Edge
- From 12
Opera
- From 15
Safari on iOS
- By 3.2 (possibly earlier)
Chrome for Android
- From 18
Firefox for Android
- From 4
Samsung Internet
- From 1.0
MDN BCD 8.1.5 · Dataset built 2026-10-08 · Mapping reviewed 2026-10-21. These dates are not individual browser-test or claim-verification dates. Unknown means the data does not establish support.