1. Home
  2. Computing & Technology
  3. Web Design / HTML

<legend></legend>

By Jennifer Kyrnin, About.com

<legend> Description:

The <legend></legend> element assigns a caption to fieldsets within forms.

<legend> Web Browser Support:

<legend> Attributes:

<legend> End Tag:

</legend> REQUIRED

<legend> Contents:

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

<legend> Valid Context:

The <legend> tag is valid within the following tags:
fieldset

<legend> Usage:

  • 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>

<legend> Special Notes:

  • Use the legend field to make your forms accessible, especially when they are not rendered in a graphical manner.

More <legend> Information:

Return to XHTML Element (HTML Tags) Library

Explore Web Design / HTML

More from About.com

  1. Home
  2. Computing & Technology
  3. Web Design / HTML
  4. HTML and XHTML
  5. XHTML
  6. HTML Tags
  7. The legend Element - Fieldset captions - XHTML 1.0 HTML 4.0

©2008 About.com, a part of The New York Times Company.

All rights reserved.