HTML fieldset tag

The HTML <fieldset> tag is used for grouping related form elements.

By using the <fieldset> element along with the <legend> element, you can make your forms more readable and easier to comprehend. This can be especially useful on long forms containing many sections.

The basic tag is written like this <fieldset></fieldset> with the form elements nested between the opening and closing tags. The (optional) <legend> tag, if used, should be placed first, followed by the other elements. You can also use the disabled attribute to disable all child elements within a <fieldset>

<fieldset>
<legend><b>Name Details</b></legend>
First Name: <input type="text" style="width:120px;"> Surname: <input type="text" style="width:120px;"><br />
Your Cat's Name: <input type="text" style="width:120px;"><br />
</fieldset>
<fieldset>
<legend><b>Gender</b></legend>
<input type="radio" name="gender" value="male"> Male
<input type="radio" name="gender" value="female"> Female
<input type="radio" name="gender" value="other"> Other
</fieldset>

Eg. :

Name Details

First Name: Surname:
Your Cat’s Name:

Gender

Male
Female
Other