Javatpoint Logo
Javatpoint Logo

HTML <label > Tag

The <label> tag is used to specify a label for an <input> element of a form. It adds a label to a form control such as text, email, password, textarea etc. It toggles the control when a user clicks on a text within the <label> element.


This tag can be used with the following two ways:

1. Set the id attribute inside the <input> element and specify its name for the for attribute inside the <label> tag.

Example: This example uses the for attribute with each label tag used in the form.

Test it Now


HTML label Tag

2.We can also use the <input> tag within the <label> element in a form.

Example: This example uses the <input> tag within the </label> element in a form.

Test it Now

Output: The output of this example is also same as the first but the difference between them is the implementation.

HTML label Tag


The following table describes all the attributes of the <label> tag:

Attributes           Description

for           It defines the form element that a label is describing.

form           It defines a form to which a label belongs.

Supporting Browsers

Elementchrome browser Chromeie browser IEfirefox browser Firefoxopera browser Operasafari browser Safari

Next TopicHTML legend tag

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA