HTML <fieldset>Tag


Examples

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 »

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

All major browsers support the <fieldset> tag.


Definition and Usage

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

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


Tips and Notes

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


Differences Between HTML 4.01 and HTML5

HTML5 adds some new attributes to the <fieldset> tag: disabled, form, and name, which are not supported in HTML 4.01.


Attributes

New: New attribute in HTML5.

Attribute Value Description
disabledNew disabled Specifies that the related form elements in the group should be disabled.
formNew form_id Specifies one or more forms to which the fieldset belongs.
nameNew text Specifies the name of the fieldset.


Global Attributes

The <fieldset> tag supportsthe Global Attributes in HTML.。


Event Attributes

The <fieldset> tag supportsthe Event Attributes in HTML.。

Other Extensions