HTML <fieldset> tag
To create related data in a group, you can use <filedset> element.
You can define the caption of the <filedset> element by using the <legend> element.
Syntax:
<fieldset>….</fieldset>
Example
<fieldset> <legend>Employee Details:</legend> Name:<br><input type="text" name="Name" value=""><br> Email Id:<br><input type="text" name="Email Id" value=""><br> Employee Id:<br><input type="text" name="Employee Id" value=""><br> Phone.No:<br><input type="text" name="Phone.No" value=""><br><br> <input type="submit" value="submit"> </fieldset>
Default CSS Values
display: block;
margin-left: 2px;
margin-right: 2px;
padding-top: 0.35em;
padding-bottom: 0.625em;
padding-left: 0.75em;
padding-right: 0.75em;
border: 2px groove (internal value);
How Browser will display
BLOCK Level.
Difference between HTML4.01, XHTML and HTML5
HTML4 | XHTML | HTML5 |
---|---|---|
No Difference | No Difference | In HTML5, the form attribute was added. Try avoiding this attribute due to lack of browser support. |
Attributes used with <fieldset> tag
Attribute | Description |
---|---|
name | Sets the name of the fieldset element as a text. |
disabled | Disables all the fields inside the fieldset so that the user cannot edit them. |
form | The form attribute defines one or more forms for the elements belong to using a form_id |
Note/Warning/Danger/Info Most of the modern browsers do not support the form attribute when it is coded with the <fieldset> tag.
Global Attributes
The <fieldset> tag supports Global attributes.
Event Attributes
The <fieldset> tag supports Event attributes.
Supporting Browsers
Related Tags
<legend> & <input> tags.