What is the <fieldset> element in HTML?

In HTML, the <fieldset> tag is used to group elements. <fieldset> is also used to get personal information from users.

We can group multiple tags/fields together between the opening <fieldset> and closing <fieldset/> tags.

Syntax

Opening and closing tags are required to show captions.

The syntax is shown below:

<fieldset>fieldset content</fieldset>

Attributes

<fieldset> supports many attributes and mostly deals with a global attribute.

  • Align: Specifies alignment as left, right, center, top, or bottom.
  • Disabled: Specifies a group of related form elements that should be disabled.
  • Form: Specifies the form of fieldset.
  • Name: Specifies a name for the fieldset.

Code

The code snippet below takes the following details from the user:

  • Student Name
  • Subject
  • Birthday
  • Course Link

In line 18, the submit button submits all data/information of the user.

  • HTML

Free Resources