HTML 5 <legend> tag
Definition and Usage
The legend element defines a caption for the <fieldset>, <figure>, and the
<details> elements.
Differences Between HTML 4.01 and HTML 5
In HTML 4.01 the <legend> tag only applied to the <fieldset> element.
In HTML 5 the <legend> tag applies to the elements: <fieldset>, <figure>, and
<details>
The align attribute is no longer supported in HTML 5. Use CSS instead.
Example
Attributes
- 4: indicates if the attribute is defined in HTML 4.01
- 5: indicates if the attribute is defined in HTML 5
| Attribute |
Value |
Description |
4 |
5 |
| align |
top
bottom
left
right |
Defines the alignment for contents in the fieldset. Top is
default. Not supported. Use CSS to align elements. |
4 |
|
Standard Attributes
| class, contenteditable, contextmenu, dir, draggable, id,
irrelevant, lang, ref, registrationmark, tabindex, template, title |
For a full description, go to Standard
Attributes in HTML 5.
Event Attributes
| onabort, onbeforeunload, onblur, onchange, onclick,
oncontextmenu, ondblclick, ondrag, ondragend, ondragenter, ondragleave,
ondragover, ondragstart, ondrop, onerror, onfocus, onkeydown, onkeypress,
onkeyup, onload, onmessage, onmousedown, onmousemove,
onmouseover, onmouseout, onmouseup, onmousewheel, onresize, onscroll, onselect,
onsubmit, onunload |
For a full description, go to Event Attributes
in HTML 5.
Try-It-Yourself Demos
Fieldset around
data
How to draw a border with a caption around your data.
|
|
|