HTML Form Fieldset
1.The HTML fieldset tag is used for grouping related form elements.
2.The fieldset tag draws a box around the related elements.
3.The <legend> tag defines a caption for the <fieldset> element.
4.By using the fieldset tag and the legend tag, it is very easy to understand for your users.
Example: 1
<form >
<fieldset>
<legend>First and Last Name</legend>
<p>First Name: <input type="text" name="fname"></p>
<p>Last Name: <input type="text" name="lname"></p>
<p><input type="submit" name="submit" value="Save Data"></p>
</fieldset>
</form>
<fieldset>
<legend>First and Last Name</legend>
<p>First Name: <input type="text" name="fname"></p>
<p>Last Name: <input type="text" name="lname"></p>
<p><input type="submit" name="submit" value="Save Data"></p>
</fieldset>
</form>
Output
Example: 2
<form>
<fieldset>
<legend>Subscription info</legend>
<label for="name"> First Name:</label>
<input type="text" name="name" id="name" />
<br />
<label for="mail"> Last Name:</label>
<input type="text" name="mail" id="mail" />
<br />
<label for=" submit"> Save Data</label>
<input type="submit" name="submit" id="submit" />
</fieldset>
</form>
<fieldset>
<legend>Subscription info</legend>
<label for="name"> First Name:</label>
<input type="text" name="name" id="name" />
<br />
<label for="mail"> Last Name:</label>
<input type="text" name="mail" id="mail" />
<br />
<label for=" submit"> Save Data</label>
<input type="submit" name="submit" id="submit" />
</fieldset>
</form>
Output