English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML Tag Directory

HTML: <a> hreflang attribute

<a> hreflang attribute is used to specify the language category of the document in the link, this online example demonstrates how to use the <a> hreflang attribute, browser compatibility, syntax definition, and detailed information about its attribute values.

HTML <a> tag

Online example

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

<a hreflang="zh" href="https://www.oldtoolbag.com/">Basic Tutorial Website</a>
Test and see ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

All mainstream browsers support the hreflang attribute.

Definition and Usage

The hreflang attribute specifies the language of the linked document.
This attribute should only be used when the href attribute is set.
Note: This attribute is purely advisory.

Note: Unlike the lang attribute of HTML, the hreflang attribute does not specify the language used in the content of the tag, but specifies the language used in the document called by the href attribute.

HTML 4.01 with HTML5differences

none.

Syntax

<a hreflang="language_code">

Attribute Values

ValueDescription
language_codedouble-character language codes specify the language of the linked document.
To view all available language codes, please visit our  Language Code Reference Manual.

HTML <a> tag