<legend>


HTML <legend> Tag

Instance

<!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8"> 
<title>php中文网(php.cn)</title> 
</head>
<body>

<form>
 <fieldset>
  <legend>Personalia:</legend>
  Name: <input type="text"><br>
  Email: <input type="text"><br>
  Date of birth: <input type="text">
 </fieldset>
</form>

</body>
</html>

Run Example»

Click the "Run Instance" button to view the online instance


Browser support

1000.png

Currently most browsers support < legend> tag.


Tag definition and usage instructions

The <legend> element defines the title for the <fieldset> element.


Differences between HTML 4.01 and HTML5

The "align" attribute has been deprecated in HTML 4.01 and HTML5 does not support this attribute. Not recommended for use. Please use CSS to set the alignment of the <legend> element.


Properties

PropertiesValueDescription
aligntop
bottom
left
right
HTML5 is not supported. HTML 4.01 is deprecated. Not recommended for use. Please use styles instead. Defines the alignment for the titles in the fieldset.


Global attributes

<legend> tag supports global attributes, see the complete attribute table HTML global attributes.


Event attributes

<legend> tag supports all HTML event attributes.