HTML/Elements/legend

From W3C Wiki
< HTML‎ | Elements
Jump to: navigation, search

<legend>

The <legend> element represents a caption for the rest of the contents of the legend element's parent fieldset element.

Point

  • As the first child of a fieldset element. [Example A]

HTML Attributes

See global attributes.


Examples

Example A

[try it]:

<fieldset name="userinfo">
  <legend>User information</legend>
  <label for="name">Name</label>
  <input type="text" name="name" id="name" size="40">
  <label for="address">Address</label>
  <input type="text" name="address" id="address" size="40">
  <label for="phone">Phone</label>
  <input type="text" name="phone" id="phone" size="40">
</fieldset>

Legend01.png

HTML Reference

The HTML5 specification defines the <legend> element in 4.10.5 The legend element.