legend element | legend object
[This documentation is preliminary and is subject to change.]
Inserts a caption into the box drawn by the fieldSet object.
![]() ![]() |
Standards information
- Document Object Model (DOM) Level 2 HTML Specification, Section 1.6.5
- HTML 4.01 Specification, Section 17.1
HTML information
| Closing Tag | required |
|---|---|
| CSS Display | block |
DOM Information
Inheritance Hierarchy
Node
Element
HTMLElement
legend
Remarks
The first LEGEND element in a FIELDSET is used as the caption of the FIELDSET. Additional LEGEND elements are ignored.
Build date: 3/8/2012
Styling Limitation - addendum
Same observation here -- behavior is different than 4 other browsers (Firefox, Safari, Opera, and Chrome).
.
While trying to fix a display issue where IE wraps DIV elements not exhibiting an explicit length (despite the absence of the "clear:" attribute), as I literally specified larger and larger arbitrary widths (until the DIV returned to its expected position in IE), the gap between the end of the legend text and the start of the border grew larger and larger, until the DIV popped up where it was supposed to be...but the gap turned out to be silly.
.
.
While trying to fix a display issue where IE wraps DIV elements not exhibiting an explicit length (despite the absence of the "clear:" attribute), as I literally specified larger and larger arbitrary widths (until the DIV returned to its expected position in IE), the gap between the end of the legend text and the start of the border grew larger and larger, until the DIV popped up where it was supposed to be...but the gap turned out to be silly.
.
I'll have to explain to my clients that it's a limitation of IE (or perhaps blocks), since the other browsers render it "correctly" and (strangely) two other fieldsets intermixed with DIV's (on the same page) are just fine, with and without widths.
- 9/18/2008
- InfotechCapital
- 9/18/2008
- InfotechCapital
Styling limitation
There doesn't seem to be any way to change the gap between the legend and the fieldset border in Internet Explorer.
- 3/26/2008
- darrenoh
- 3/31/2008
- Noelle Mallory

