HTML <legend> Tag
<fieldset>
<legend>Name Details</legend>
<p><label>First Name: <input name="fName"></label>
<p><label>Surname: <input name="sName"></label>
<p><label>Preferred Name: <input name="pName"></label>
</fieldset>
<fieldset>
<legend>Gender</legend>
<p><label><input type="radio" name="gender" value="male"> Male</label>
<p><label><input type="radio" name="gender" value="female"> Female</label>
</fieldset>
The above example demonstrates usage of the <legend>
element.
The <legend>
element is used for providing a caption for <fieldset>
elements. This can make longer HTML forms more readable, as they allow the user to scan the different form sections at a glance.