Share on Google+Share on Google+

HTML5 legend example, Example of <legend> tag in HTML5.

In this tutorial you will learn about the <legend> tag of the HTML. This tag is used for adding the caption on the frameset.

HTML5 legend example, Define <legend> tag of HTML5.


In this tutorial, you will see the use of legend tag. The legend tag is used for adding title or caption of frameset. The frameset is used for grouping related controls of form. A frameset looks like a box. A legend tag is a pair tag, it must have both start tag and end tag. It can be use after fieldset start tag.

Declaration Syntax :
Declaration syntax of legend in HTML5.

                           <legend> Content of caption </legend >

Example of <legend> in HTML5:

<!DOCTYPE html >
<title>Title of document</title>
<h2>Implementation of label tag of HTML5.</h2>
<form id="from1"><table style="width: 49%">
<tr><td><fieldset > <legend>Student Information</legend>
StudName<input type="text" ><br>
StudAddress<input type="text" ></fieldset></td></tr>
<tr><td > </td></tr> <tr><td >
<fieldset><legend>Employee Details</legend>
EmpName<input type="text" ><br>
EmpAddress<input type="text" >
</fieldset></td> </tr>

Download this code

Difference Between HTML5 and HTML4.01:

The legend tag is available in both HTML5 and HTML4.01. But in html5 it can be use in <figure>, <details> and <frameset> tag.


Posted on: September 9, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.