HTML hreflang Attribute (original) (raw)

Last Updated : 11 Jul, 2025

**HTML hreflang Attribute is used to specify the language for a linked document. It is used only when the href attribute is set.

**Syntax:

**Attribute Value:

The hreflang attribute contains a single value **language_code which is the two-letter language code and used to specify the language of the linked document e.i. en for English, hi for Hindi, etc.

**HTML hreflang Attribute Supported Tags

Examples of HTML hreflang Attribute

**Example 1: the This Example illustrates the use of hreflang attribute in anchor element.

html `

HTML hreflang Attribute

GeeksForGeeks

HTML hreflang Attribute

    <p>Welcome to
        <a href=

"http://www.example.com:4097/test.htm#part2" id="GFG" rel="nofollow" hreflang="en-us" target="_self"> GeeksforGeeks

`

**Output:

HTML hreflang Attribute Example

**Example 2: This Example illustrates the use of hreflang attribute in area element.

HTML `

HTML area hreflang Attribute alt_attribute
<map name="shapemap">
    <!-- area tag contained image. -->
    <area shape="poly" 
          coords="59, 31, 28, 83, 91, 83" 
          href=

"https://media.geeksforgeeks.org/wp-content/uploads/20190227165802/area2.png" alt="Triangle" hreflang="en">

    <area shape="circle" 
          coords="155, 56, 26" 
          href=

"https://media.geeksforgeeks.org/wp-content/uploads/20190227165934/area3.png" alt="Circle" hreflang="en">

    <area shape="rect" 
          coords="224, 30, 276, 82" 
          href=

"https://media.geeksforgeeks.org/wp-content/uploads/20190227170021/area4.png" alt="Square" hreflang="en">

`

**Output:

HTML hreflang Attribute Example

HTML hreflang Attribute Example Output

Supported Browsers:

The browser supported by _hreflang Attribute are listed below: