html tutorial - fieldset <fieldset>-tag in HTML - html5 - html code - html form



  • The <fieldset>tag is used to grouping the related form elements.
  • The <fieldset>tag is used to draws a box around a related elements.
  • Using the <fieldset> tag, you can create your forms and your users are easily understand.
  • And the legend tag also same as the previous point.

Syntax for <fieldset> tag:

<fieldset>content</fieldset>

Differences between HTML 4.01 and HTML5

HTML 4.0.1

  • Not supported in HTML 4.01.

HTML5

  • Supported in HMTL5.

Sample Coding for <fieldset> tag:

Tryit<!DOCTYPE html>
<html >
    <body>
        <form>
            <fieldset>
                <legend>Wikitechy database</legend><br>
                Student Name: <input type="text"><br>
                Email:        <input type="text"><br>
                Date of birth:<input type="text"><br>
            </fieldset>
        </form>
    </body>
</html>

Code Explanation for <fieldset> tag:

code explanation for field tag

  1. The <fieldset>tag is used to group a related elements to form and text boxes are declare for the related elements.
  2. The <legend>tag is used for the caption of the data in fieldset tag.

Output of <fieldset> tag:

output for field tag

  1. Here the output displays the text boxes for the elements by using the <fieldset> tag.

Attribute for <fieldset>tag:

Attribute Value HTML4 HTML5 Description
disabled disabled No Yes It specifies that a group of related form elements disabled
form form_id No Yes It specifies one or more forms which belongs to fieldset.
name text No Yes It specifies a name for the fieldset.

Browser Support for <fieldset> tag in HTML:

Yes Yes Yes Yes Yes

Tips and Notes

  1. The <legend>tag is defined as a caption for the <fieldset>tag.

Related Searches to fieldset tag in html