Skip to content
Related Articles

Related Articles

Improve Article
How to specify the language of the document in a given link in HTML5 ?
  • Last Updated : 17 Mar, 2021

In HTML5 language of the document in a given link is specified by hreflang attribute. The value (or languageCode) passed here is code of the website language. (for e.g. if the document/website in the given link is in English en is passed as  the value).

Below are the examples that illustrates the use of hreflang attribute.

Example 1:

HTML




<!DOCTYPE html>
<html>
    
<body>
  <h2>Welcome To GFG</h2>
  <p>Click 
    <a href=
       hreflang="en">
     here
    </a>to visit GeeksForGeeks webiste
  </p>
  
</body>
  
</html>

Output: Upon clicking on the above link it will redirect to the following document which is in English: 



Example 2:

HTML




<!DOCTYPE html>
<html>
    
<body>
  <h2>Welcome To GFG</h2>
    <p>Click 
      <a href=
         hreflang="es">
        here
      </a
      to visit Wikipedia spanish webiste
    </p>
</body>
    
</html>

Output:  Upon clicking on the above link it will redirect to the following document which is in Spanish:




My Personal Notes arrow_drop_up
Recommended Articles
Page :