HTML fieldset tag

HTML <fieldset> encloses the the form elements (Form structure) in a block under a common name.

The common name is specified using legend element.

<form method="post" action="files/fieldsettag.php">
  <fieldset>
  <legend> Form </legend>
   Name:<input type="text" name="sname"><br>
   Email:<input type="email" name="email"><br>
   <input type="submit" name="submit">
  </fieldset>
 </form>

</>
Form Name:
Email:

Tag Uses

Specific uses of <fieldset> tag

It encloses the form in a block under a common title.

Nested fieldset elements may also be used.

Tag omission

Both starting and ending tags are necessary for the fieldset element.

Global Attributes

All the global attributes are applicable on the fieldset element.

Tag Attributes

Attributes that are applicable to <fieldset> tag
disabled

This attribute disables all the elements in the fieldset. None of the input is editable.

<fieldset disabled><legend> <form> form structure </form> </legend></fieldset>
form

This attribute links fieldset element to a specific form.

<fieldset form="The name of form to associate with fieldset"> <legend></legend> </fieldset>
name

This attribute gives a special or unique name to the fieldset element.

<fieldset name="a unique name"><legend> <form> form structure </form> </legend></fieldset>


Was this article helpful?

 

Email:

Message: