HTML <legend> Tag
Description:
The <legend> tag is used for labelling the fieldset element. By using the fieldset tag and the <legend> tag, you can make your forms much easier to understand for your users. The fieldset tag is used to group the form elements whilst the <legend> tag provides a label for the fieldset.
Specific Attributes:
| Attribute | Definition |
| align | For alignment. Top, left, top, bottom. This attribute is deprecated |
Other Attributes:
| Attribute | Definition |
| dir |
Specifies the text direction for the content in
an element.
|
| class | Specifies a classname for an element. |
| id | Specifies a unique id for an element. |
| lang | Specifies a language code for the content in an element. |
| title | Specifies a title to associate with the element. Many browsers will display this when the cursor hovers over the element (similar to a "tool tip"). |
| style | Specifies an inline style for an element. |
Example Code:
<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>