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

HTML Reference Manual

HTML Tag Comprehensive

HTML link hreflang Attribute

The hreflang attribute specifies the language of the text in the linked document, and this attribute is only used when the href attribute is set.

 HTML <link> tag

Online Example

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

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML <link> hreflang Attribute Usage-基础教程(oldtoolbag.com)</title>
<link href="tag_link.php" rel="parent" rev="subsection" hreflang="en">
</head>
<body>
<p>3codebox.com example page.</p>
<p>The hreflang attribute will not display any special content in any mainstream browser. However, it can be used by search engines or scripts./p>
</body>
</html>
Test it out ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

Almost no mainstream browsers support the hreflang attribute. However, it can be used through search engines or scripts.

Definition and Usage

The hreflang attribute specifies the language of the text in the linked document.

The hreflang attribute can only be used when the href attribute is set.

Note:This attribute is purely advisory.

HTML 4.01 With HTML5Differences

None.

Syntax

<link hreflang="langauge_code">

Attribute Value

ValueDescription
language_codeLanguage codes that are of double letters, specify the language of the linked document.

To view all available language codes, please visit our Language Code Reference Manual.

 HTML <link> tag