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