HTML fieldset tag
HTML

HTML fieldset tag

Mishel Shaji
Mishel Shaji

The HTML fieldset tag is used to group similar items in a web form. The <legend> tag is used to set caption for a fieldset.

Attributes

AttributeValue
disabledThis attribute, introduced in HTML 5, is used to specify whether the elements within the tag should be disabled. 
nameThe name attribute is used to provide name for the element.
formThe form attribute specifies the form which the element belongs to.

Example

<fieldset>
    <legend>Choose a language</legend>

    <input type="radio" id="cs" name="language">
    <label for="cs">C#</label><br/>
    <input type="radio" id="java" name="language">
    <label for="java">Java</label><br/>
    <input type="radio" id="php" name="language">
    <label for="php">PHP</label>
</fieldset>

Output

Choose a language

Example – disabled fieldset

<fieldset disabled>
    <legend>Choose a language</legend>

    <input type="radio" id="cs" name="language">
    <label for="cs">C#</label><br/>
    <input type="radio" id="java" name="language">
    <label for="java">Java</label><br/>
    <input type="radio" id="php" name="language">
    <label for="php">PHP</label>
</fieldset>

Output

Choose a language