<legend> element represents a title or a caption for contents of the
<fieldset> element. The content of
<legend> is displayed at the top of the frame that contains it.
<legend> element accepts
align as a single specific attribute.
align accepts one of the following inputs:
top: legend is aligned to the top of its container.
bottom: legend is aligned to the bottom of its container.
left: legend is aligned to the left of its container.
right: legend is aligned to the right of its container.
alignattribute is obsolete in HTML5 but can be used with style sheets.
<legend> element supports global events and attributes.
The following examples demonstrate how to use the
<legend> element in HTML:
<form>element contains a
<fieldset>element that represents a single category of information. The category of information in the above example is Contact Information.
<fieldset>element contains multiple types of inputs in the Contact Information category.
<legend>tag indicates the category of information.
View all Courses