HTML5 <legend> Tag


How to group related elements in a form:

<label for="male">Male</label>
<input type="radio" name="sex" id="male" />
<br />
<label for="female">Female</label>
<input type="radio" name="sex" id="female" />

Try it yourself »

Definition and Usage

The legend element defines a caption for the <fieldset>, <figure>, and the <details> elements.

Differences Between HTML 4.01 and HTML5

In HTML 4.01 the <legend> tag only applies to the <fieldset> element.

In HTML5 the <legend> tag applies to the elements: <fieldset>, <figure>, and <details>

The align attribute is not supported in HTML5. Use CSS instead.

Standard Attributes

The <legend> tag also supports the Standard Attributes in HTML5.

Event Attributes

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