HTML <a> hreflangAttribute

HTML a 标签参考手册HTML <a> Tag

Examples

The hreflang attribute specifies the language of the linked document:

<a hreflang="en" href="../index.html">Example</a>

Try it Yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the hreflang attribute.


Definition and Usage

The hreflang attribute of the <a> tag is used to specify the language of the linked document.

This attribute only works if the href attribute is set.

Note:Unlike the lang attribute, the hreflang attribute does not specify the language of the content within the tag, but specifies the language of the document referenced by the href attribute.


Differences between HTML 4.01 and HTML5

NONE.


Syntax

<a hreflang="language_code">

Attribute Values

Value Description
language_code A two-character language code that specifies the language of the linked document.
To see all available language codes, please visit ourLanguage Code Reference。


HTML a 标签参考手册HTML <a> Tag

Other Extensions