Dofactory.com
Dofactory.com

HTML <area> hreflang Attribute

The hreflang attribute on an <area> tag specifies the language and country region of the area link.

This value is purely advisory.

Example

#

An hreflang attribute on 3 <area> elements.
These attributes specify links as pages in the US English language.

Computer Monitor Keyboard Mouse
<img src="/img/html/computer-map.png" 
     alt="Computer" 
     usemap="#computermap">

<map name="computermap">
  <area hreflang="en-US" shape="rect" alt="Monitor" coords="253,142,16,2" 
        href="https://www.google.com/search?q=monitor" target="_blank">
  <area hreflang="en-US" shape="rect" alt="Keyboard" coords="262,218,0,156" 
        href="https://www.google.com/search?q=keyboard" target="_blank">
  <area hreflang="en-US" shape="circle" alt="Mouse" coords="267,234,22" 
        href="https://www.google.com/search?q=mouse" target="_blank">
</map>

Using hreflang

The hreflang attribute specifies the language and country region of the linked resource.

Its value is for advisory purposes only.

The first two characters in the hreflang value represents the language code, such as 'en'.

And the last two characters in the hreflang value represents the country code, such as 'US'.

For example, the hreflang value of 'en-GB' specifies the English language in Great Britain.

Note: The hreflang attribute requires that href has a value.


Syntax

<area href="URL" hreflang="language-code-country-code" />

Values

#

Value Description
language-code-country-code The first 2 characters represent the language code of the linked page.
The last two characters represent the country code (optional).

Browser support

Here is when hreflang support started for each browser:

Chrome
1.0 Sep 2008
Firefox
1.0 Sep 2002
IE/Edge
1.0 Aug 1995
Opera
1.0 Jan 2006
Safari
1.0 Jan 2003

You may also like

 Back to <area>

Author: Jack Poorte
Published: Jun 20 2021
Last Reviewed: Sep 30 2023


Quick question: what's your favorite/least favorite part of Dofactory?


Guides