HTML | PHP | Forum

HTML <legend> tag


<legend> - </legend>

Definition and Usage

The LEGEND element defines a caption for form controls grouped by the FIELDSET element. The LEGEND element must be at the start of a FIELDSET, before any other elements.

Optional Attributes

Attribute Value Description
for id_of_another_field Defines which form element the label is for. Set to an ID of a form element.

Note: If this attribute is not specified, the label is associated with its contents.

Optional Attributes

Attribute Value Description
align top
Defines the alignment for contents in the fieldset. Top is default

Standard Attributes

id, class, title, style, dir, lang, xml:lang

For a full description, go to Standard Attributes.

Event Attributes

accesskey, onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup

For a full description, go to Event Attributes.


Source Output
<legend>Formula 1</legend>
<input type="radio" name="f1" id="car1" />
<label for="car1">Ferrari</label>
<br />
<input type="radio" name="f1" id="car2" />
<label for="car2">Williams</label>
Formula 1


Learn HTML
HTML Tutorial

HTML Reference
HTML by function
HTML by Alphabet

HTML events
HTML attributes
HTML color names

<h1> to <h6>


Copyright 2005-8 Sunilcare.  All Rights Reserved.
Comments or suggestions? Contact us.About us