The <legend></legend> element assigns a caption to fieldsets within forms.
- Netscape 6, 7
- Mozilla 1
- Firefox 1
- Internet Explorer 4, 5, 6
- Opera 6, 7, 8
- Safari 1
- HTML 4.0
- XHTML 1.0: XHTML Forms Module, XHTML Legacy Module
- accesskey (optional)
- align (optional) DEPRECATED
- class (optional)
- dir (optional)
- id (optional)
- lang (optional)
- onclick (optional)
- ondblclick (optional)
- onkeydown (optional)
- onkeypress (optional)
- onkeyup (optional)
- onmousedown (optional)
- onmousemove (optional)
- onmouseout (optional)
- onmouseover (optional)
- onmouseup (optional)
- style (optional)
- title (optional)
Text. The following tags are valid within the <legend> tag:
a, abbr, acronym, applet, b, basefont, bdo, big, br, button, cite, code, dfn, em, font, i, iframe, img, input, kbd, label, map, object, q, s, samp, script, select, small, span, strike, strong, sub, sup, textarea, tt, u, var
The <legend> tag is valid within the following tags:
fieldset
- Standard <legend>
<form>
<fieldset>
<legend align="right">Name</legend>
<legend align="left">Required Field</legend>
<label for="firstname">
First Name:
<input name="firstname" id="firstname">
</label>
<legend align="left">Non-required Field</legend>
<label for="lastname">
Last Name:
<input name="lastname" id="lastname">
</label>
</fieldset>
</form>
- Use the legend field to make your forms accessible, especially when they are not rendered in a graphical manner.

