Home > DeveloperSection > Beginner > legend tag in html

legend tag in html


HTML5 HTML5 
Ratings:
0 Comment(s)
 3715  View(s)
Rate this:

<legend> tag in html

We will use legend tag to define caption for fieldset, figure and details element. In html 4.01 legend tag defines caption only for fieldset element but in html5 legend tag defines caption for fieldset, figure and details element.

Following example will demonstrate use of legend tag to define caption for fieldset

<body>

    <form>

        <fieldset style="width:300px;">

            <legend style="margin-left:70px">Personal Information</legend>

            First Name:&nbsp;&nbsp; <input type="text" size="30" /><br />

            Last Name:&nbsp;&nbsp; <input type="text" size="30" /><br />

            Email:&nbsp;&nbsp; <input type="text" size="30" /><br />

            Date of birth:&nbsp;&nbsp; <input type="text" size="10" />

        </fieldset>

    </form>

</body>

Output of following code snippet is as follows

legend tag in html


Don't want to miss updates? Please click the below button!

Follow MindStick