HTML hreflang Attribute

Definition and Usage

The hreflang attribute specifies the language of the linked document.

Note: This attribute is purely advisory.

This attribute is used only to indicate the language of the linked document. It doesn't had to do any special things to the linked document.

Applies to

The hreflang attribute can be used on the following elements:

Elements Attribute
<a> hreflang
<area> hreflang
<link> hreflang

Examples

A Example

The hreflang attribute specifies the language of the document in the link:

<a href="https://www.pinfinitys.com" hreflang="en">PI.com</a>

Area Example

An image map, with clickable areas:

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

Link Example

Here, the hreflang attribute indicates that the linked document is in English:

<link href="tag_link.html" rel="parent" rev="subsection" hreflang="en">

Browser Support

The hreflang attribute has the following browser support for each element:

Element          
a Yes Yes Yes Yes Yes
area Yes Yes Yes Yes Yes
link Yes Yes Yes Yes Yes

Comments