English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Online Tools

Reference Manual

HTML: <label> tag

: <progress> tag

HTML <label> element (label) represents the description of an element in the user interface. The <label> tag is used to generate a title for user input (such as <button>, <input>, <meter>, <output>, <progress>, <select>, or <textarea> tags). This tag is also commonly referred to as the <label> element.

Online Example

Example
!doctype html>
<html>
<head>-8<meta charset="UTF
">5 <title>HTML3Label tag usage (Basic Tutorial Website w/codebox.com)</title>
</title>
head>
<body>1<h/>label usage<1h
>-<form action="demo
  form.php">/<label for="address">Address: <
  <label for="company">Company: <
  <input type="text" name="company" id="company"><br>/<label for="address">Address: <
  label>
  <input type="text" name="address" id="address"><br>
</<input type="submit" value="Submit">
</body>
</html>
Test and see ‹/›

Browser compatibility

IEFirefoxOperaChromeSafari

Most web browsers currently support the <label> tag.

Label definition and usage instructions

The <label> tag defines a label (mark) for the input element. It is used to display the title of an interactive control on a webpage.

The label element does not present any special effect to the user. However, it improves accessibility for mouse users. If you click on the text within a label element, it will trigger this control. That is to say, when the user selects the label, the browser will automatically focus on the form control related to the label.

The for attribute of the <label> tag should be the same as the id attribute of the related element.

Hints and Notes

Hint:"for" attribute can bind the label to another element. Set the value of the "for" attribute to the value of the id attribute of the related element.

HTML 4.01 HTML5and

"form" attribute is the difference between HTML5 new attributes.

Attribute

New: HTML5 New attribute.

AttributeValueDescription
forelement_idSpecifies which form element the label is bound to.
formHTML5form_idSpecifies one or more forms to which the label field belongs.

Global attributes

<label> tag supports global attributes, see the complete attribute table HTML global attributes.

event attributes

<label> tag supports all HTML event attributes.