The HTML <legend> tag represents a caption for the <fieldset> element. This tag does not have any special attributes, only HTML global attributes are supported.
Example
<fieldset>
<legend>Choose a language</legend>
<input type="radio" id="cs" name="language">
<label for="cs">C#</label><br/>
<input type="radio" id="java" name="language">
<label for="sasquatch">Java</label><br/>
<input type="radio" id="php" name="language">
<label for="mothman">PHP</label>
</fieldset>
Output
Attributes
The legend tag supports HTML Global attributes.
Attribute | Value | Description |
top bottom left right | Specifies the alignment of the caption. This attribute is not supported in HTML 5. |
Subscribe
Join the newsletter to get the latest updates.