HTML <legend> Tag
In this tutorial, we will learn about legend tag in HTML with the help of examples.
<legend> Tag
Legend tag <legend> is used to define a caption for <fieldset> tag.
Syntax
<legend>........</legend>
Example
<!DOCTYPE html>
<html>
<head>
<title>Legend Tag</title>
</head>
<body>
<fieldset>
<legend>Writing name</legend>
<label for = "name">Name :</label>
<input type = "text" id = "name">
<input type = "submit" value = "submit">
</fieldset>
</body>
</html>
Output
Specific Attribute
Attribute | Value | Description |
---|---|---|
align | top bottom left right center |
It specifies the content alignment |
Global Attribute
Legend Tag support all the global attributes of HTML.
Event Attribute
Legend Tag support all the event attributes of HTML.
Next Tutorial
We hope that this tutorial helped you develop better understanding of the concept of <legend> tag in HTML.
Keep Learning : )
In the next tutorial, you'll learn about HTML <li>
Tag.