HTML legend tag

Last Updated on April 26, 2023 by Roshan Parihar

HTML legend tag is used to show title or captions for the fieldset elements.

This makes form elements much easier for the user to understand.


Syntax

Output

Person gender details

Male
Female
Others


List of HTML legend tag attributes

Sr. No. Attribute options Description
1 align This option used to align text to the specified directions. The values for this are left, center, right, top and center.

Resources and References

1. W3C Specification.
2. HTML living standard
3. W3C project using Github