<label> tag

HTML <label> tag

The <label> tag describes text label for the <input> tag field of the form.

The <input> elements can be fields such as textarea, text, email, password, button etc.

Syntax:
<label for=”value”>Text</label>

Example

<form>
  <label for="Married">Married</label>
  <input type="radio" name="status" id="Married" value="Married"><br>
  <label for="Single">Single</label>
  <input type="radio" name="status" id="Single" value="Single"><br>
  <label for="widow">widow</label>
  <input type="radio" name="status" id="widow" value="widow"><br><br>
</form>

How Browser will display

INLINE.

Difference between HTML4.01, XHTML and HTML5

HTML4 XHTML HTML5
None None New form attribute is added to HTML5 tag

Attributes used with <label> tag

Attribute Description
for To attach the label to the element using an element-id. The value of the element-id must be the same as the value of the "id" attribute which is used in the input control.
form The form attribute defines one or more forms for the elements belong to using a form_id.

Global Attributes

The <label> tag

Event Attributes

The <label> tag supports Event attributes.

Default CSS Value

cursor: default;

Supporting Browsers

supporting-browsers for tags

Related Tags

<form>, <fieldset>, <legend>, <select>, <textarea>, <option>, <optgroup>, <button>, <datalist> and <keygen> tags.

Tutorials for all brains!