A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/html/html-link-hreflang-attribute/ below:

HTML <link> hreflang Attribute - GeeksforGeeks

HTML <link> hreflang Attribute

Last Updated : 12 Jul, 2025

HTML <link> hreflang attribute specifies the language of the linked resource. It helps search engines understand the language targeting of a document. Without the href attribute, there is no use of this attribute in the link element.

HTML link hreflang Attribute Syntax:
<link hreflang="langauge_code">
HTML link hreflang Attribute Values: HTML link hreflang attribute Example:

This example illustrates the use of hreflang attribute in link Element. 

html
<!DOCTYPE html>
<html>

<head>
    <title>
        HTML link hreflang Attribute
    </title>
    <link rel="stylesheet" type="text/css" 
          href="styles.css" hreflang="en-us">
</head>

<body style="text-align:center;">
    <h1>GeeksgorGeeks</h1>
    <h2>
        HTML link hreflang Attribute
    </h2>

</body>

</html>

Output:

HTML link hreflang Attribute Output Explanation HTML link hreflang Attribute Use-Cases 1. How to set the language of text in the linked document in HTML5 ?

In HTML5, set the language of text in the linked document using the hreflang attribute within the <link> tag, specifying the language code.

2. How to Fix Hreflang Tag Errors with Google Search Console?

To fix hreflang tag errors in Google Search Console, ensure proper implementation by accurately specifying language and regional variations for each page. Review and correct any identified errors.

Supported Browsers: HTML link hreflang Attribute supported browsers are listed below.



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4