html label tag

In the html <label> tag is used to insert label for form element and also can use to <output>, <progress> and <meter> tag. It tag mostly you can use to radio button, checkbox option. Which tag for attribute is a equal to id attribute and you can use any one attribute for <label> tag.

The <label> tag does not special for user. This provides improvement for mouse users. All main browsers are supported in <label> tag example browsers are IE, firfox .<label> tag standard attributes are accesskey, class, dir, id, lang, style, title and xml:lang and event attributes are onblur, onclick, ondblclick, onfocus, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onkeydown, onkeypress and onkeyup.

Syntax:

<label> ... </label>

Example Code

Which is your favorite animal?
<form>
  <input type="radio" name="animal" id="Dog" />
  <label for="Dog">Dog</label>
  <input type="radio" name="animal" id="Cat" />
  <label for="Cat">Cat </label>
</form>

Out Put:



Which is your favorite animal?

In the above example <label> tag has been added to two keywords that first one is dog and second one is cat.you can select any one option box in the example form .




Content