asp.net.ph

Skip Navigation LinksHome > Abakada: Back to Basics > Language References > HTML Elements > LEGEND Element

<LEGEND Element | LEGEND Object


Assigns a caption to a FIELDSET object.HTML 2, 3.2, 4, 4.01, 5

HTML Syntax

Remarks

The LEGEND element allows authors to assign a caption to a FIELDSET. The legend improves accessibility when the FIELDSET is rendered non-visually.

This element must be the first element in FIELDSET.

NOTE: Both start and end tags are required.

Attributes

The <legend> element has no attribute of its own, but supports global attributes common to all HTML elements.

Example

This sample demonstrates the use of LEGEND along with the FIELDSET and LABEL elements to develop an accessible form. The FIELDSET defines the container for the form.

<form>
<fieldset>
<legend>Accessibility Form</legend>
<table cellpadding=5>
<tbody>
<tr>
   <th>Label</th>
   <th>Control Range</th></tr>
<tr>
   <td><label for=ofirstname tabindex=-1>
      <u>F</u>irst Name</label></td>
   <td><input accessKey=f id=ofirstname 
      name=firstname tabindex=1></td></tr>
<tr>
   <td><label for=olastname tabindex=-1>
      <u>L</u>ast Name</label></td>
   <td><input accessKey=l id=olastname 
      name=lastname tabindex=2></td></tr>
<tr>
   <td><label for=oselect1 tabindex=-1>
      Favorite <u>P</u>astime</label></td>
   <td><select accessKey=p id=oselect1 
         name=select1 tabindex=3>
      <option selected>Web
      <option>Movies
      <option>Concerts
      <option>Pubs
      <option>Books</option>
   </select></td></tr>
</tbody></table>
</fieldset>
</form>

 Show me 

See Also

FIELDSET



Check out related books at Amazon

© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note