Use the <legend> tag to include a title. The HTML <legend> tag s used to define a title for <fieldset> tag. It supports the following attribute −
Attribute | Value | Description |
---|---|---|
Align | top bottom left right | Deprecated − Specifies the content alignment. |
Example
You can try to run the following code to implement <legend> tag in HTML −
<!DOCTYPE html> <html> <head> <title>HTML legend Tag</title> </head> <body> <form> <fieldset> <legend>Student Details</legend> Student Name: <input type = "text"><br /> MBA Subjects:<input type = "text"><br /> </fieldset> </form> </body> </html>