From Web Education Community Group
< HTML‎ | Elements
Jump to: navigation, search


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


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

HTML Attributes

See global attributes.


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


HTML Reference

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