HTML <link> hreflang Attribute

Definition and Usage

hreflang Attribute specifies the language of the text in the linked document.

Only when href Attribute This attribute should only be used

Note:This attribute is purely advisory.

Example

In this case, the hreflang attribute indicates that the linked document is in Chinese:

<link href="tag_link.asp" rel="parent" rev="subsection" hreflang="zh">

Try It Yourself

Syntax

<link hreflang="langauge_code">

Attribute Value

Value Description
language_code

Language codes consisting of two letters, specifying the language used by the linked document.

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

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support

Note:hreflang Attributes will not be displayed as any special style in any mainstream browser. However, they can be used by search engines or scripts.