View video tutorial

HTML <fieldset> Tag

HTML

The <fieldset> tag groups the related elements in a form.

HTML <fieldset> Tag


The <fieldset> tag is used to group the elements associated with a form.

A nested <legend> element is used to provide a caption for <fieldset>

Element Attributes

Attribute Value Description
disabled disabled This specifies that all descendants of the fieldset, are disabled.
form form_id This specifies that the id attribute of a form element that you want to be part of fieldset, even if it's not inside the form.
name text Specifies what is the name of the fieldset.

Global attributes

Global attributes may be applied on all elements, although some elements may have no effect on them.

<accesskey>, <class>, <contenteditable>, <contextmenu>, <data-*>, <dir>, <draggable>, <dropzone>, <hidden>, <id>, <lang>, <spellcheck>, <style>, <tabindex>, <title>, <translate>.

Learning with HTML Editor "Try it Now"

You can edit the HTML code and view the result using online editor.

Example

<fieldset>
    <legend>Information:</legend>
    <label for="fname">First name:</label>
    <input type="text" id="fname" name="fname"><br><br>
    <label for="lname">Last name:</label>
    <input type="text" id="lname" name="lname"><br><br>
    <label for="email">Email:</label>
    <input type="email" id="email" name="email"><br><br>
    <label for="dob">Date of Birth:</label>
    <input type="date" id="dob" name="dob"><br><br>
    <input type="submit" value="Submit">
</fieldset>
Try it Now »

Click on the "Try it Now" button to see how it works.