HTML <legend> Tag

Description

The <legend> HTML element is used to create the title of a group of form elements, which is defined using the <fieldset>. A group of elements is indicated in the browser with a frame, and the text that is located inside the <legend> container is embedded in this frame.

Properties

Permitted Parents
A <fieldset> whose first child is this <legend> element
Content
Inline and text
Start/End Tags
Start tag: required, End tag: required

Example

<form>
<fieldset>
<legend>Personal Information:</legend>
Name: <input type="text" size="30" /><br />
Email: <input type="text" size="30" /><br />
Date of birth: <input type="text" size="10" />
</fieldset>
</form>

Attributes

Attribute Definition
align For alignment. Top, left, top, bottom. This attribute is deprecated

Global Attributes

The <legend> tag also supports the Global Attributes in HTML5

Event Attributes

The <legend> tag also supports the Event Attributes in HTML5

Browser Support

Desktop
Explorer Edge Chrome Firefox Opera Safari
6YesYes1YesYes
Tablets / Mobile
Android Chrome Firefox Opera Safari Samsung
YesYes4XYesYes