Fieldset and Legend in HTML Form
Table of Content:
Large forms can be confusing for users, so it ’ s good practice to group together related form controls. The
<fieldset>
and <legend>
elements do exactly this — help you group controls.
<fieldset>
element creates a border around the group of form controls to show that they
are related.
The <legend>
element allows you to specify a caption for the <fieldset>
element, which acts
as a title for the group of form controls. When used, the <legend>
element should always be the
first child of the <fieldset>
element.