<fieldset> Tag in HTML

The <fieldset> tag in HTML is used to group related elements in a form, typically used to group together form controls, such as inputs and labels, to provide a visual grouping. It also allows for better accessibility and clarity in forms.

Key Points on <fieldset> Tag:

Syntax of <fieldset> Tag:

Syntax Example

<fieldset>
            
        </fieldset>

Example of <fieldset> Tag in HTML:

This example demonstrates how to use the <fieldset> tag to group form elements together.

Code Example


        <form>
            <fieldset>
                <legend>Personal Information</legend>
                <label for="name">Name:</label>
                <input type="text" id="name" name="name">
                <br>
                <label for="email">Email:</label>
                <input type="email" id="email" name="email">
            </fieldset>
        </form>
                

Output

Personal Information

The <fieldset> tag is a great way to organize form controls and is often used in longer forms to group related information. It provides a more accessible and visually clear layout, especially when combined with the <legend> tag to describe the purpose of the grouped fields.