HTML <fieldset>
Tag
Topic: HTML5 Tags ReferencePrev|Next
Description
The <fieldset>
tag specifies a set of form fields. It is generally used to group logically related controls and labels within a web form. Grouping form controls makes it easier for users to understand their purpose and makes the documents more accessible.
The following table summarizes the usages context and the version history of this tag.
Placement: | Block |
---|---|
Content: | <legend> as first child; after that block, inline, and text |
Start/End Tag: | Start tag: required, End tag: required |
Version: | HTML 4, 4.01, 5 |
Syntax
The basic syntax of the <fieldset>
tag is given with:
The example below shows the <fieldset>
tag in action.
Example
Try this code »<form action="http://www.example.com/" method="post">
<fieldset>
<legend>Gender</legend>
<input type="radio" name="gender" value="male" id="male">
<label for="male">Male</label>
<input type="radio" name="gender" value="female" id="female">
<label for="female">Female</label>
</fieldset>
</form>
Tag-Specific Attributes
The <fieldset>
tag doesn't have any specific attribute.
Global Attributes
Like all other HTML tags, the <fieldset>
tag supports the global attributes in HTML5.
Event Attributes
The <fieldset>
tag also supports the event attributes in HTML5.
Browser Compatibility
The <fieldset>
tag is supported in all major modern browsers.
Basic Support—
|
Further Reading
See tutorial on: HTML Forms.