VOOZH about

URL: https://www.geeksforgeeks.org/html/how-to-set-the-language-of-text-in-the-linked-document-in-html5/

⇱ How to set the language of text in the linked document in HTML5 ? - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

How to set the language of text in the linked document in HTML5 ?

Last Updated : 23 Jul, 2025

The approach of this article is to specify the language of the text in the linked document in HTML5 by using a hreflang attribute in the HTML Tag. The value (or languageCode) passed here is the code of the linked document. (for e.g. if the document/website in the given link is in English en is passed as the value).

Syntax:

<element hreflang="language_code"> 

Example 1: Below code illustrates the use of hreflang attribute in the link element. 

Output: Above link document is written in the English Language.

👁 Image

Example 2: In this example, we will use Spanish in 

 Output: Above link document written in Spanish Language. 

👁 Image

Comment