X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR BOOTSTRAP XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

HTML <label> for Attribute

HTML label Tag Reference HTML <label> tag

Example

Two radio buttons with labels:

<form action="demo_form.asp">
  <label for="male">Male</label>
  <input type="radio" name="sex" id="male" value="male"><br>
  <label for="female">Female</label>
  <input type="radio" name="sex" id="female" value="female"><br>
  <input type="submit" value="Submit">
</form>

Try it Yourself »

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The for attribute is supported in all major browsers.


Definition and Usage

The for attribute specifies which form element a label is bound to.


Differences Between HTML 4.01 and HTML5

NONE.


Syntax

<label for="element_id">

Attribute Values

Value Description
element_id The id of the element the label is bound to


HTML label Tag Reference HTML <label> tag

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook