Home Tutorial Html Html5 HTML5 legend example, Example of <legend> tag in HTML5.

 
 

HTML5 legend example, Example of <legend> tag in HTML5.
Posted on: September 9, 2010 at 12:00 AM
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.

Description:

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:

Code:
LegendTag.html
<!DOCTYPE html >
<html>
<head>
<title>Title of document</title>
</head><body>
<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>
</table>
</form></body>
</html>
Output:

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.

Related Tags for HTML5 legend example, Example of <legend> tag in HTML5.:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.