HTML hreflang attribute

HTML hreflang attribute specifies the language used in the linked page.

<p>Language of the linked resource is English.</p>
<a href="http://www.web4college.com" hreflang="en"> Go to coding site </a>
</>

Language of the linked resource is English.

Go to coding site

Attribute values

All possible values of hreflang attribute

The value of the language is the valid BCD language.

A browser should know only the language of the linked document and not the metadata.

Related Tags

The tags that support hreflang attribute

<a> tag

It defines hyperlink of the external resources. hreflang attribute defines the language of the linked document.

<area> tag

area tag specifies link on an area. hreflang is also applicable on the area tag.

<area href="URL" hreflang="ar" />

In the above example, the language of the linked resource is Arabic.

link tag links the current document to the external documents.

<link href="URL" hreflang="en" >

The language of the linked resource is English.



Was this article helpful?