Last Updated on April 26, 2023 by Roshan Parihar
HTML fieldset tag is used to show form elements in groups.
The fieldset tag is used with <legend> tag to show details . This makes form elements much easier for the user to understand.
Syntax
1 2 3 4 |
<fieldset> <legend>Enter some legend text here</legend> put form control elements here for groupings </fieldset> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
</form> <fieldset> <legend>Motorcycle Brands:</legend> <label for="Brand">Select your Brand</label> <select name="Brand"> <option value="Bajaj">Bajaj</option> <option value="Hero Honda">Hero Honda</option> <option value="TVS">TVS</option> <option value="Harley Davidson">Harley Davidson</option> <option value="Yamaha">Yamaha</option> <option value="Kawasaki">Kawasaki</option> <option value="Suzuki">Suzuki</option> </select> </fieldset> </form> |
Output
List of HTML fieldset tag attributes
Sr. No. | Attribute options | Description |
---|---|---|
1 | align | This option used to align text to the specified directions. The values for these are left, center, right, top and center. |
2 | disabled | This attribute is used to disable the element. The value for this is disable. |
3 | form | This is used to include the form id to specify fieldset associated with which form. The value for this is the id of the form. |
4 | name | This is used specify the name of the fieldset. The value for this is the name for fieldset. |
Resources and References
1. W3C Specification.
2. HTML living standard
3. W3C project using Github