HTML5 <fieldset> Tag

Example

Group related elements in a form:

<form>
  <fieldset>
    <legend>ContentList</legend>
    Name: <input type="text" /><br />
    Email: <input type="text" /><br />
    Date of birth: <input type="text" />
  </fieldset>
</form>
Code it Online »

Definition and Usage

The <fieldset> tag is used to logically group together elements in a form.

The <fieldset> tag draws a box around the related form elements.

The <legend> tag defines a caption for the fieldset element.

Differences Between HTML 4.01 and HTML5

HTML5 has the attributes disabled, form, and name, which was not supported in HTML 4.01.

Tips and Notes

Hint: Use the <legend> element to add a caption to the fieldset.

Attributes

Attribute Value Description
disabled disabled Specifies that a fieldset should be disabled
form formname Specifies one or more forms the fieldset belongs to
name value Specifies the name of the fieldset

Standard Attributes

The <fieldset> tag also supports the Standard Attributes in HTML5.

Event Attributes

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


Have Any Suggestion? We Are Waiting To Hear from YOU!

Your Query was successfully sent!