HTML 5 <fieldset> Tag
Example
Group related elements in a form:
<form>
<fieldset>
<legend>Personalia:</legend>
Name: <input type="text" /><br />
Email: <input type="text" /><br />
Date of birth: <input type="text" />
</fieldset>
</form> |
Try it yourself » |
Definition and Usage
The <fieldset> tag is used to logically group together elements in a form.
The <fieldset> tag draws a box around the related form elements.
The <legend> tag defines a caption for the fieldset element.
Differences Between HTML 4.01 and HTML 5
HTML 5 has the attributes disabled, form, and name, which was not supported in HTML
4.01.
Tips and Notes
Note: You can disable a fieldset with the new attribute: disabled.
Tip: Use the <legend> element to add a caption to the fieldset.
Attributes
| Attribute |
Value |
Description |
| disabled |
disabled |
Defines if the fieldset is visible or not |
| form |
formname |
Defines one ore more forms the fieldset belongs to |
| name |
value |
Defines the name of the fieldset |
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.
Create a free Flash website with our simple, online web design editing platform. Stunning templates
and user-friendly tools make website building easy and fun.
Start Creating your free website now!
|