HTML <fieldset> Tag

Description

The <fieldset> HTML tag is a structural element used to group related form controls within a web form. It is often used in conjunction with the 'legend' element, which provides a brief description or label for the group of form controls. By wrapping form elements like input fields, checkboxes, or radio buttons with <fieldset>, web developers can create a visual and semantic grouping of these elements. This enhances the accessibility and organization of forms, making it easier for users to understand and interact with the input fields that share a common purpose or theme. Additionally, <fieldset> elements can be styled and customized to improve the overall user experience.

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

Attribute Definition
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 table will show you the current browser support for the HTML <fieldset> tag.

Desktop
Edge Chrome Firefox Opera Safari
1211154
Tablets / Mobile
Chrome Firefox Opera Safari Samsung Webview
184143.214.4

Last updated by CSSPortal on: 30th September 2023