HTML <legend> tag

When writing in HTML, the <legend> tag is used to designate a caption for the <fieldset> element. The following sections contain information about this tag, including an example of it in use, and related attributes and browser compatibility.
The <legend> tag belongs to a group of tags called form elements.
Example of <legend> code
<form>
<fieldset>
<legend>Personal Information:</legend>
Name: <input type="text"><br>
Address: <input type="text"><br>
Email: <input type="text"><br>
Phone: <input type="text">
</fieldset>
</form>
Example result
Deprecated attributes
Within an HTML tag, an attribute dictates certain aspects of an HTML element. Attributes are made up of a name and value pair; all tags support standard attributes. The following table shows all of the deprecated unique HTML attributes for the <legend> tag, and a description of each. While these attributes may work with the some versions of HTML, they will eventually be phased out. You should use CSS to adjust the dimensions of this element.
Attribute | Description |
---|---|
align | Designates the alignment of the caption. |
Compatibility
Edge | Internet Explorer | Firefox | Safari | Opera | Chrome |
---|---|---|---|---|---|
All versions | 6.0+ | All versions | All version | All versions | All versions |
Additional form elements
- <button>
- <datalist>
- <fieldset>
- <input>
- <keygen>
- <label>
- <optgroup>
- <option>
- <output>
- <select>
- <textarea>
Browser, Caption, Compatibility, HTML form tag, HTML input tag, HTML label tag, URL, Web design terms