English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML reference manual

HTML tag大全

HTML: <legend> etichetta

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.

Online example

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.

Browser compatibility

IEFirefoxOperaChromeSafari

La maggior parte dei browser supporta il tag <legend>.

Definizione e istruzioni per l'uso del tag

 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>.

Differenze tra HTML 4.01 e HTML5

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à

ProprietàValoreDescrizione
allineamentosuperiore
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.

Proprietà globali

L'etichetta <legend> supporta le proprietà globali, consulta la tabella completa delle proprietà Proprietà globali HTML.

proprietà degli eventi

L'etichetta <legend> supporta tutti gli Proprietà degli eventi HTML.