Attributo HTML hreflang
Definizione e utilizzo
L' hreflang
attributo specifica la lingua del documento collegato.
Nota: questo attributo è puramente consultivo.
Si applica a
L' hreflang
attributo può essere utilizzato sui seguenti elementi:
Elementi | Attributo |
---|---|
<a> | hreflang |
<zona> | hreflang |
<link> | hreflang |
Esempi
Un esempio
L'attributo hreflang specifica la lingua del documento nel collegamento:
<a href="https://www.w3schools.com" hreflang="en">W3Schools</a>
Esempio di zona
Una mappa immagine, con aree cliccabili:
<img src="planets.gif" width="145" height="126" alt="Planets" usemap="#planetmap">
<map name="planetmap">
<area shape="rect" coords="0,0,82,126" alt="Sun"
href="sun.htm" hreflang="en">
</map>
Esempio di collegamento
Qui, l'attributo hreflang indica che il documento collegato è in inglese:
<link href="tag_link.asp" rel="parent" rev="subsection" hreflang="en">
Supporto browser
L' hreflang
attributo ha il seguente supporto del browser per ogni elemento:
Element | |||||
---|---|---|---|---|---|
a | Yes | Yes | Yes | Yes | Yes |
area | Yes | Yes | Yes | Yes | Yes |
link | Yes | Yes | Yes | Yes | Yes |