The hreflang attribute on an <a> (anchor) tag specifies the language.
Optionally the country region of the link may also be included in the value.
This attribute requires that href has a value.
This value is purely advisory.
An hreflang attribute on an <a> tag.
This attribute specifies the link is a page in English.
Go to <a hreflang="en" target="_blank"
href="https://microsoft.com/en-us/">Microsoft</a>.
The hreflang attribute specifies the language and country region of the linked page.
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.
<a href="URL" hreflang="language-code-country-code" />
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). |
An <a> tag with an hreflang attribute set to English (en) in the United States (US).
Go to <a hreflang="en-US" target="_blank"
href="https://microsoft.com/en-us/">Microsoft</a>.
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 |