The <legend> tag is child tag of <fieldset> tag. It comes after the <fieldset> tag in the HTML document. It define the title of the fieldset, For this purpose it is easy to understand the form elements.
Example of Code
<form>
<fieldset>
<legend>Employee basic information:</legend>
<label>First Name</label><br>
<input type="text" name="fname"><br>
<label>Last Name</label><br>
<input type="text" name="lname"><br>
<label>Enter Email</label><br>
<input type="email" name="email"><br><br>
<input type="Submit"><br>
</fieldset>
</form>
Output
