English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
When grouping related items in an HTML form, the HTML <legend> tag is used to generate a title for the <fieldset> tag. This tag is also commonly referred to as the <legend> element.
Combine related elements in a form:
<!doctype html> <html> <head> <meta charset="UTF-8"> <title>Use of HTML5 fieldset tag (Basic Tutorial Website oldtoolbag.com)</title> </head> <body> <form> <fieldset> <legend>Customer Information (oldtoolbag.com)</legend> Name: <input type="text"><br> Address: <input type="text"><br> Phone number: <input type="text"> </fieldset> </form> </body> </html>Test to see ‹/›
In this HTML5 document example, we have created a <legend> tag that provides a title for the three groups of <input> controls. The <legend> tag will display the title 'Customer Information (oldtoolbag.com)' above these grouped controls.
IEFirefoxOperaChromeSafari
La maggior parte dei browser supporta il tag <legend>.
L'elemento <legend> è per <fieldset>L'elemento definisce il titolo.
Il titolo generato dal tag <legend> viene presentato prima dei controlli di form relativi a <fieldset> e sembra galleggiare sul bordo superiore di <fieldset>.
L'attributo "align" è stato abbandonato in HTML 4.01, non supportato da HTML5. Non raccomandato. Utilizza CSS per impostare l'allineamento dell'elemento <legend>.
Proprietà | Valore | Descrizione |
---|---|---|
allineamento | superiore inferiore sinistra destra | HTML5 non supporta. HTML 4.01 è obsoleto. Non raccomandato. Utilizza lo stile al suo posto. Definisce il modo di allineamento del titolo all'interno di fieldset. |
L'etichetta <legend> supporta le proprietà globali, consulta la tabella completa delle proprietà Proprietà globali HTML.
L'etichetta <legend> supporta tutti gli Proprietà degli eventi HTML.