CSS Portal

HTML <fieldset> Tag

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

Description

The <fieldset> HTML element is used to group related elements within a form, creating a logical structure for form controls. It serves both semantic and visual purposes, helping users and assistive technologies understand the relationship between different input fields. By grouping inputs, <fieldset> improves form readability and organization, particularly in complex forms with multiple sections.

Visually, most browsers render a <fieldset> with a border around its contents, giving a clear separation from other parts of the form. Typically, this border is slightly inset and can include rounded corners depending on browser styles or CSS customization.

A <fieldset> can also include a <legend> element, which provides a caption or title for the grouped controls. The <legend> is displayed at the top of the fieldset by default and helps indicate the purpose of the grouped inputs. For example, a fieldset containing contact information might have a legend titled "Personal Details," immediately signaling the context to the user.

Beyond its visual and organizational benefits, <fieldset> contributes to accessibility. Screen readers announce the fieldset and its legend, making it easier for users who rely on assistive technology to navigate forms efficiently. Additionally, the grouping conveys a logical hierarchy that can be useful for form validation scripts and client-side or server-side processing.

Properties

Permitted Parents
Any element that accepts flow content
Content
<legend> as first child; after that block, inline, and text
Start/End Tags
Start tag: required, End tag: required

Example

<form>
<fieldset>
<legend>Personal Information:</legend>
Name: <input type="text" size="30" />
Email: <input type="text" size="30" />
</fieldset>
</form>

Attributes

disabled
Specifies that a group of related form elements should be disabled.
form
Specifies one or more forms the fieldset belongs to.
name
Specifies a name for the fieldset.

Global Attributes

The <fieldset> tag also supports the Global Attributes in HTML5

Event Attributes

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

Browser Support

The following information will show you the current browser support for the HTML <fieldset> tag. Hover over a browser icon to see the version that first introduced support for this HTML tag.

This tag is supported by all modern browsers.
Desktop
Chrome
Edge
Firefox
Opera
Safari
Tablets & Mobile
Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-

Last updated by CSSPortal on: 26th December 2025

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!