Il tag HTML <label>



Descrizione

Il tag HTML <label> è usato per aggiungere un etichetta al campo di un form.

Esempio

<!DOCTYPE html>
<html>
<head>
<title>HTML label Tag</title>
</head>
<body>
<label for="email">EMAIL-ID:<br /> <input type="email" value="" name="emailid" size="30" placeholder="Enter a valid email address"><br /><br />
<label for="phone">PHONE NO:<br /> <input type="text" value="" name="phno" size="30" maxlength="10" placeholder="Enter a valid phone number" pattern="[0-9]{10}"><br /><br />
</body>
</html>

Produrrà il seguente risultato:

Attributi Globali

Questo tag supporta tutti gli attributi globali descritti in - HTML - Referenze Attributi

Attributi Specifici

Il tag HTML <label> supporta anche i seguenti attributi aggiuntivi:

AttributoValoreDescrizione
formhtml-5form_idDefinisce uno o piè form a cui appartiene il form
forcontrol idSpecifica a quale campo si riferisce l' etichetta. Fa riferimento all' attributo id del campo di riferimento.

Attributi Evento

Questo tag supporta tutti gli attributi evento descritti in - HTML - Referenze Eventi

Compatibilità Browser

ChromeFirefoxIEOperaSafariAndroid
SiSiSiSiSiSi
html_tags_reference.htm
Advertisements