Open In App
Related Articles

HTML | hreflang Attribute

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report

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

<element hreflang="language_code"> 

Applicable


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

html

<!DOCTYPE html>
<html>
 
<head>
    <title>
        HTML hreflang Attribute
    </title>
</head>
 
<body>
    <center>
        <h1>
        GeeksForGeeks
    </h1>
 
        <h2>
        HTML <a> hreflang Attribute
    </h2>
 
         
 
<p>Welcome to
            <a href=
            id="GFG"
            rel="nofollow"
            hreflang="en-us"
            target="_self">
                GeeksforGeeks
            </a>
        </p>
 
  
    </center>
</body>
 
</html>

                    

Output: 


Supported Browsers: The browser supported by hreflang Attribute are listed below: 
 

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari


 



Last Updated : 02 Dec, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads