Html5 label tag

In the html5 <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.


<label> ... </label>

Example Code

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

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 can select any one option box in the example form .