Fandom

HTML & CSS Wiki

Label

649pages on
this wiki
Add New Page
Comments0 Share

The HTML <label></label> element defines a label for an <input /> element. This element provides a usability improvement for mouse users, because if the user clicks on the text within the <label> element, it toggles the control. This element's for attribute should be equal to the id attribute of the related element to bind them together.


Attributes

Attribute Value Description
for id of another field Defines which <form> element the label is for. Set to an ID of a <form> element. If this attribute is not specified, the label is associated with its contents.
form formname Defines one or more forms the label field belongs to.


HTML example:

<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" />
</form>

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.