HTML <legend> Tag

If this site has been useful, we’d love your support! Running this site takes time and resources, and every small contribution helps us keep creating valuable content. Consider buying us a coffee to keep things going strong!

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

None

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

The following table will show you the current browser support for the HTML <legend> tag.

Desktop
Edge Chrome Firefox Opera Safari
121112.13
Tablets / Mobile
Chrome Firefox Opera Safari Samsung Webview
18412.1114.4

Last updated by CSSPortal on: 30th March 2024