The HTML <legend> tag s used to define a caption for <fieldset> tag.
<!DOCTYPE html>
<html>
<head>
<title>HTML legend Tag</title>
</head>
<body>
<form>
<fieldset>
<legend>Details</legend>
Student Name: <input type="text"><br />
MCA Subjects:<input type="text"><br />
Course Link:<input type="url" name="websitelink">
</fieldset>
</form>
</body>
</html>
This will produce following result:
DetailsStudent Name:
MCA Subjects:
Course Link:
The HTML <legend> tag also supports following additional attributes:
Attribute | Value | Description |
---|---|---|
align | top bottom left right |
Deprecated- Specifies the content alignment. |