HTML <a> hreflang eigenschap

definitie en gebruik

hreflang de eigenschap de taal van het gelinkte document definieert.

alleen als ingesteld href eigenschap use this attribute only when

Note:This attribute is purely advisory.

Detailed explanation

it can only be specified when the href attribute is used hreflang attribute. With lang attribute similarly,hreflang The value of the attribute is also a double-character language code of the ISO standard. Unlike the lang attribute,hreflang The 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.

Example

The hreflang attribute specifies the language of the linked document:

<a href="https://www.codew3c.com" hreflang="zh">W3School</a>

Try it yourself

Syntax

<a hreflang="language_code">

Attribute value

Value Description
language_code

Two-letter language codes specify the language of 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