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
NoneGlobal 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 | |||||
12 | 1 | 1 | 12.1 | 3 |
Tablets / Mobile | |||||
18 | 4 | 12.1 | 1 | 1 | 4.4 |
Last updated by CSSPortal on: 30th March 2024