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

HTML5 has the attributes disabled, form, and name, which was not supported in HTML 4.01.


Tips and Notes

Tip: Use the <legend> element to add a caption to the fieldset.


Attributes

New : New in HTML5.

Attribute Value Description
disabledNew disabled Specifies that a fieldset should be disabled
formNew formname Specifies one or more forms the fieldset belongs to
nameNew value Specifies the name of the fieldset

Standard Attributes

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


Event Attributes

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