Signup/Sign In
PUBLISHED ON: FEBRUARY 19, 2021

HTML Legend Tag

In HTML, the <legend> tag is used to provide a caption to the content of its parent <fieldset> tag.

  • Basically <legend> tag is used to define a title for child content.

  • We can use <legend> tag to perform various CSS properties.

HTML <legend> Tag Syntax and Usage

The <legend> element requires the start(opening) tag and end(closing) tag.

<legend>
.....content here
</legend>

HTML5 <legend> Tag Basic Example

Here, we have a basic example for a clear understanding of the <legend> tag:

Using various CSS Properties with <legend> Tag

Here, we are using CSS properties with This tag.

HTML <legend> Tag Attributes

This element does not have any specific attributes although this element supports Global and Event attributes.

Default CSS Settings for HTML <legend> Tag

legend {
  display: block;
  padding-left: 2px;
  padding-right: 2px;
  border: none;
}

Browser Support for HTML <legend> Tag

Following browsers support this attribute:

  • Firefox 1+

  • Google Chrome 1+

  • Internet Explorer 4+

  • Apple Safari 1+

  • Opera 4+



About the author:
Aspiring Software developer working as a content writer. I like computer related subjects like Computer Networks, Operating system, CAO, Database, and I am also learning Python.