content logo

Learn HTML:

Html legend tag

The HTML <legend> tag s used to define a caption for <fieldset> tag.

 

Example

<!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:

 

Specific Attributes

The HTML <legend> tag also supports following additional attributes:

Attribute Value Description
align top
bottom
left
right
Deprecated- Specifies the content alignment.
#

HTML legend Example

#

HTML legend Code

#

HTML legend Tutorial