The HTML <fieldset> tag is used for grouping related form elements. By using the fieldset tag and the legend tag, you can make your forms much easier to understand for your users.
<!DOCTYPE html> <html> <head> <title>HTML fieldset Tag</title> </head> <body> <form> <fieldset> <legend>Details</legend> Student Name: <input type = "text"><br /> MCA Subjects:<input type = "text"><br /> Course Link:<input type = "url" name = "websitelink"> </fieldset> </form> </body> </html>
This will produce the following result −
This tag supports all the global attributes described in HTML Attribute Reference
The HTML <fieldset> tag also supports the following additional attributes −
Attribute | Value | Description |
---|---|---|
align | left right center top bottom |
Deprecated − Specifies the content alignment. |
disabled ![]() |
disabled | Specifies that a group of related form elements should be disabled. |
form ![]() |
form_id | Specifies forms which belongs to fieldset. |
name ![]() |
text | Specifies a name for fieldset. |
This tag supports all the event attributes described in HTML Events Reference
Chrome | Firefox | IE | Opera | Safari | Android |
---|---|---|---|---|---|
Yes | Yes | Yes | Yes | Yes | Yes |