Tag <fieldset>

Image Tutorials

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>

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

1. Definition and Usage

The <fieldset> tag is used to group related elements in a form.

The <fieldset> tag draws a box around the related elements.

Tip: The <legend> tag defines a caption for the <fieldset> element.


2. Differences Between HTML 4.01 and HTML5

HTML5 has added new attributes for <fieldset>.


3. Optional Attributes

Attribute Value HTML4 HTML5 Description
disabled disabled Specifies that a group of related form elements should be disabled
form form_id Specifies one or more forms the fieldset belongs to
name text Specifies a name for the fieldset

4. Standard Attributes

The <fieldset> tag supports the Standard Attributes in HTML.


5. Event Attributes

The <fieldset> tag also supports the Standard Event Attributes in HTML.

Rate article