HTML - <legend> Tag


Advertisements


Description

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 the following result −

Global Attributes

This tag supports all the global attributes described in − HTML Attribute Reference

Specific Attributes

The HTML <legend> tag also supports the following additional attributes −

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

Event Attributes

This tag supports all the event attributes described in − HTML Events Reference

Browser Support

Chrome Firefox IE Opera Safari Android
Yes Yes Yes Yes Yes Yes

html_tags_reference.htm

Advertisements