Name

legend — HTML 4.01 | HTML5

Synopsis

<legend> . . . </legend>

Assigns a caption to a fieldset (it must be the first child of a fieldset element). This improves accessibility when the fieldset is rendered nonvisually.

Start/End Tags

Required/Required

Attributes

Core, Internationalization, Events, HTML5 Global Attributes

accesskey="character"

Assigns an access key (keyboard shortcut) to an element for quicker access.

align="top|bottom|left|right"

Deprecated. Not in HTML5. Aligns the text relative to the fieldset.

Example

<fieldset>
  <legend>Mailing List Sign-up</legend>
  <ul>
  <li><label>Add me to your mailing list
           <input type="radio" name"list"></label></li>
  <li><label>No thanks <input name"list" value="no">
        </label></li>
   </ul>
</fieldset>

Get HTML & XHTML Pocket Reference, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.