articles

Home / DeveloperSection / Articles / legend tag in html

legend tag in html

Anonymous User7987 28-Jul-2011

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


Updated 13-Dec-2019
I am a content writter !

Leave Comment

Comments

Liked By