CodesJava

Easy learning with example program codes

Legend HTML

HTML <legend> Tag

To insert a title or caption to the <fieldset> tag, the HTML <legend> tag is used. For this, the first child of the HTML <fieldset> tag, should be the HTML <legend> tag. Thus understanding the purpose of the grouped form elements becomes easy.

Syntax:

<legend>Content<legend>

Example:

<!DOCTYPE html>
<html>
<body>
<form>
 <fieldset>
  <legend>Subject Details:</legend>
  Name: <input type="text"><br><br>
  Subject: <input type="text"><br><br>
  Faculty Name: <input type="text">
 </fieldset>
</form>
</body>
</html>

Output:

Explanation:

In the above example, we have used the <legend> tag to add title to the <fieldset> tag.

Tag Specific Attributes:

AttributeValueUses
aligntop

bottom

left

right

Used to define the caption alignment.Not Supported in HTML5.

Global Attributes:

The HTML Global attributes are supported by the HTML <legend> tag.

Event Attributes:

The HTML Event attributes are supported by the HTML <legend> tag.

Supporting Browsers:

Chrome, IE, Firefox, Opera and Safari.

Please follow and like us:
error
Posted in HTML   









Copyright © 2019 CodesJava DMCA.com Protection Status