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
Attribute | Value |
disabled | This attribute, introduced in HTML 5, is used to specify whether the elements within the tag should be disabled. |
name | The name attribute is used to provide name for the element. |
form | The 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
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>