HTML TutorialsHtml What is
In the html <legend> tag is used to caption for group of element and it is a parent element. Also you can use inside of <figure>,<fieldset> and <details> elements in the html but html 4 use to <legend > tag for the <fieldset> only.
If you use <legend> tag, user can easily understand html form or element. In the align attribute only support in html for <legend> element suppose if you need to use css instead.
Html <legend> tag optional attributes is align and standard attributes are accesskey, class ,dir ,id ,lang ,style ,title and xml:lang and event attributes are onclick, ondblclick ,onmousedown ,onmousemove ,onmouseout ,onmouseover ,onmouseup ,onkeydown ,onkeypress and onkeyup.
In the above example has been added <fieldset> and <legend> tag for Registration Form.