HTML

The tag is used to specify a label for an 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

Syntax:

This tag can be used with the following two ways:

1. Set the id attribute inside the element and specify its name for the for attribute inside the

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

Test it Now

Output:

HTML label Tag

2.We can also use the tag within the

Example: This example uses the tag within the 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

Attributes

The following table describes all the attributes of the 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

Element chrome browser Chrome ie browser IE firefox browser Firefox opera browser Opera safari browser Safari
Yes Yes Yes Yes Yes

Next TopicHTML legend tag




Hot Tutorials

Contact US

Email:jjw.quan@gmail.com

HTML label Tag
10/30