HTML legend - how to use <legend> tag

The HTML <legend> tag is used to define a caption for a group of tags within a form tag. Grouping of tags can be achieved using the <fieldset> tag.

Attributes

The legend tag supports the global and event attributes.

Examples:

<form> <fieldset> <legend>Contact info:</legend> <label for="fname">First Name</label> <input type="text" id="fname" /> <label for="lname">Last Name</label> <input type="text" id="lname" /> </fieldset> </form>