Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 933873 of <legend>

  • Revision slug: Web/HTML/Element/legend
  • Revision title: <legend>
  • Revision id: 933873
  • Created:
  • Creator: Sebastianz
  • Is current revision? Yes
  • Comment Replaced list for properties by table (bug 1212755) and removed translated tags

Revision Content

The HTML <legend> Element (or HTML Legend Field Element) represents a caption for the content of its parent {{HTMLElement("fieldset")}}.

Content categories None.
Permitted content Phrasing content.
Tag omission {{no_tag_omission}}
Permitted parent elements A {{HTMLElement("fieldset")}} whose first child is this <legend> element
DOM interface {{domxref("HTMLLegendElement")}}

Attributes

This element only includes the global attributes.

Examples

See {{HTMLElement("form")}} for examples on <legend>.

Specifications

Specification Status Comment
{{SpecName("HTML WHATWG", "forms.html#the-legend-element", "<legend>")}} {{Spec2("HTML WHATWG")}} Definition of the legend element
{{SpecName("HTML WHATWG", "rendering.html#the-fieldset-and-legend-elements")}} {{Spec2("HTML WHATWG")}} Suggested default rendering of the fieldset and legend elements
{{SpecName("HTML5 W3C", "forms.html#the-legend-element", "<legend>")}} {{Spec2("HTML5 W3C")}}  
{{SpecName("HTML4.01", "interact/forms.html#h-17.10", "<legend>")}} {{Spec2("HTML4.01")}} Initial definition

Browser compatibility

{{CompatibilityTable}}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support {{CompatVersionUnknown}} {{CompatGeckoDesktop("1.0")}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}}
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support {{CompatVersionUnknown}} {{CompatGeckoMobile("1.0")}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}}

See also

  • Others form-related elements: {{HTMLElement("form")}}, {{HTMLElement("option")}}, {{HTMLElement("label")}}, {{HTMLElement("button")}}, {{HTMLElement("select")}}, {{HTMLElement("datalist")}}, {{HTMLElement("optgroup")}}, {{HTMLElement("fieldset")}}, {{HTMLElement("textarea")}}, {{HTMLElement("keygen")}}, {{HTMLElement("input")}}, {{HTMLElement("output")}}, {{HTMLElement("progress")}} and {{HTMLElement("meter")}}.

{{HTMLRef}}

Revision Source

<p>The <strong>HTML <code>&lt;legend&gt;</code> Element</strong> (or <em>HTML Legend Field Element</em>) represents a caption for the content of its parent {{HTMLElement("fieldset")}}.</p>

<table class="properties">
 <tbody>
  <tr>
   <th scope="row"><a href="/en-US/docs/HTML/Content_categories">Content categories</a></th>
   <td>None.</td>
  </tr>
  <tr>
   <th scope="row">Permitted content</th>
   <td><a href="/en-US/docs/HTML/Content_categories#Phrasing_content">Phrasing content</a>.</td>
  </tr>
  <tr>
   <th scope="row">Tag omission</th>
   <td>{{no_tag_omission}}</td>
  </tr>
  <tr>
   <th scope="row">Permitted parent elements</th>
   <td>A {{HTMLElement("fieldset")}} whose first child is this <code>&lt;legend&gt;</code> element</td>
  </tr>
  <tr>
   <th scope="row">DOM interface</th>
   <td>{{domxref("HTMLLegendElement")}}</td>
  </tr>
 </tbody>
</table>

<h2 id="Attributes">Attributes</h2>

<p>This element only includes the <a href="https://developer.mozilla.org/en-US/docs/HTML/Global_attributes">global attributes</a>.</p>

<h2 id="Examples">Examples</h2>

<p>See {{HTMLElement("form")}} for examples on <code>&lt;legend&gt;</code>.</p>

<h2 id="Specifications">Specifications</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName("HTML WHATWG", "forms.html#the-legend-element", "&lt;legend&gt;")}}</td>
   <td>{{Spec2("HTML WHATWG")}}</td>
   <td>Definition of the <code>legend</code> element</td>
  </tr>
  <tr>
   <td>{{SpecName("HTML WHATWG", "rendering.html#the-fieldset-and-legend-elements")}}</td>
   <td>{{Spec2("HTML WHATWG")}}</td>
   <td>Suggested default rendering of the <code>fieldset</code> and <code>legend</code> elements</td>
  </tr>
  <tr>
   <td>{{SpecName("HTML5 W3C", "forms.html#the-legend-element", "&lt;legend&gt;")}}</td>
   <td>{{Spec2("HTML5 W3C")}}</td>
   <td>&nbsp;</td>
  </tr>
  <tr>
   <td>{{SpecName("HTML4.01", "interact/forms.html#h-17.10", "&lt;legend&gt;")}}</td>
   <td>{{Spec2("HTML4.01")}}</td>
   <td>Initial definition</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<p>{{CompatibilityTable}}</p>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Chrome</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatGeckoDesktop("1.0")}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Android</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>IE Mobile</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatGeckoMobile("1.0")}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatVersionUnknown}}</td>
  </tr>
 </tbody>
</table>
</div>

<h2 id="See_also">See also</h2>

<ul>
 <li>Others form-related elements: {{HTMLElement("form")}}, {{HTMLElement("option")}}, {{HTMLElement("label")}}, {{HTMLElement("button")}}, {{HTMLElement("select")}}, {{HTMLElement("datalist")}}, {{HTMLElement("optgroup")}}, {{HTMLElement("fieldset")}}, {{HTMLElement("textarea")}}, {{HTMLElement("keygen")}}, {{HTMLElement("input")}}, {{HTMLElement("output")}}, {{HTMLElement("progress")}} and {{HTMLElement("meter")}}.</li>
</ul>

<p>{{HTMLRef}}</p>
Revert to this revision