English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
for attribute specifies which form element the label is bound to.
Three radio buttons with labels:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>HTML <label> for Attribute Usage-Basic Tutorial(oldtoolbag.com)</title> </head> <body> <p>Click the text label to switch options</p>> <form action="action_page.php"> <label for="male">Male</label> <input type="radio" name="gender" id="male" value="male"><br> <label for="female">Female</label> <input type="radio" name="gender" id="female" value="female"><br> <label for="other">Other</label> <input type="radio" name="gender" id="other" value="other"><br><br> <input type="submit" value="Submit"> </form> </body> </html>Test it out ‹/›
IEFirefoxOperaChromeSafari
All major browsers support the for attribute.
The for attribute specifies the form element that the label is bound to.
None.
<label for="element_id">
Value | Description |
---|---|
element_id | The id of the element bound to the label. |