HTML Tag Reference - HTML tag <label>

This <label> element creates a label and associates it with another element on the page. The element to which the label is linked must contain the id attribute.

When giving the accesskey attribute of the <label> element a value, pressing ALT and the access key will set the focus on the linked element.

Browser compatibility

<label> Yes Yes Yes Yes Yes

What's new in HTML5

The "form" attribute is new in HTML5.


Attribute Value Description
for element_id Set the owner id
form form_id Set the owner form the label belongs to

Global Attributes

The <label> tag supports the Global Attributes in HTML.

Event Attributes

The <label> tag supports the Event Attributes in HTML.

Default CSS Settings

label {
    cursor: default;


A demo showing how to use <label> tag.

     If you click on the italic text that follows or press 
     <label for="tb" 
            accesskey="a">Alt+A you will set focus on the text box
     <input id="tb" type="text" value="textbox" size="20"/>
  </p><!--from w  w w. j  a v a2 s . c  om-->

Click to view the demo