Fieldset HTML

HTML <fieldset> Tag

In an HTML form, the logically related fields or labels can be grouped using the HTML <fieldset> tag. It is however not a mandatory tag for creating an HTML form. It is used with the HTML <legend> tag to define a caption for the grouped related fields as a first child.

Syntax:

<fieldset>.....</fieldset>

Example:

<!DOCTYPE html>
<html>
<body>
<form>
 <fieldset>
  <legend>Undergraduate Details:</legend><br>
  Name of University: <input type="text"><br><br>
  Year of Passing: <input type="text"><br><br>
  Aggregate Marks: <input type="text"><br><br> 
  <input type="Submit"> 
 </fieldset>
</form>
</body>
</html>

 

Explanation:

In the above example, we have used the HTML <fieldset> tag to group logically related fields of a form.

Tag Specific Attributes:

Attribute Value Uses
disabled disabled Used to determine that a group of related form elements should be disabled.
form form_id Used to determine one or more forms the fieldset belongs to.
name text Used to determine a name for the fieldset.

Global Attributes:

The Global attributes are supported by the HTML <fieldset> tag.

Event Attributes:

The Event attributes are supported by the HTML <fieldset> tag.

Supporting Browsers:

Chrome, IE, Firefox, Opera, and Safari.