Tutorials References Exercises Videos Menu
Create Website Get Certified Upgrade

HTML hreflang Attribute


Definition and Usage

The hreflang attribute specifies the language of the linked document.

Note: This attribute is purely advisory.


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.w3schools.com" hreflang="en">W3Schools</a>
Try it Yourself »

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>
Try it Yourself »

Link Example

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

<link href="tag_link.asp" rel="parent" rev="subsection" hreflang="en">
Try it Yourself »

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