HTML <label> tag


With two input fields and related marks simple HTML form:

  <label for="male">Male</label>
  <input type="radio" name="sex" id="male" />
  <br />
  <label for="female">Female</label>
  <input type="radio" name="sex" id="female" />

Try it yourself

Browser Support

IE Firefox Chrome Safari Opera

All major browsers support <label> tag.

Safari 2 or earlier versions do not support the <label> tag.

Definition and Usage

<Label> tag for the input element defines the label (tag).

label elements do not exhibit any special effects to the user. However, it is for the mouse users to improve usability. If you click on the text within the label element, it will trigger this control. That is, when the user selects the tab, the browser will automatically focus to the associated form controls and labels.

<Label> tag attributes should be the same for the id attribute related elements.

Differences between HTML and XHTML


Tips and Notes:

Note: "for" property of the label bound to another element. Please set the value "for" property to the value of the id attribute of the related elements.


new: HTML5 new property.

Attributes value description
for id Label bound to the provisions which form elements.
form formid Specify one or more form field label belongs.

Global Properties

<label> tag supports HTML in the global properties .

Event Properties

<label> tag supports HTML in the event properties .

Examples TIY

How to define tag for the control.

Related Pages

HTML DOM Reference Manual: the Column Object