Hreflang Attribute, Use of hreflang attribute of anchor tag in HTML5.


 

Hreflang Attribute, Use of hreflang attribute of anchor tag in HTML5.

In this tutorial, you will see the use of hreflang attribute of anchor tag in HTML5.

In this tutorial, you will see the use of hreflang attribute of anchor tag in HTML5.

Hreflang Attribute, Use of hreflang attribute of anchor tag in HTML5.

In this tutorial, we will see the use of hreflang attribute and how to implement. Hreflang gives the language of linked document. This attribute can be used when href attribute is available.

hreflang Attribute :
Attribute Value Description
hreflang  language_code (ISO code) Define the language of linked document. It is two latter ISO code of language.


Declaration Syntax :

Declaration syntax of hreflang attribute in anchor tag.

                           <a hreflang="language code">Text Area</a>

Example of hreflang attribute:

Code:

hrefLangAttribute.html

<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<b>hreflang attribute of anchor tag in HTML5.</b>
<ul>

<li>
<a href="http://www.roseindia.net/" hreflang="en">
Language of specified document is english.</a></li>

</ul>
</body>
</html>
Output:

Note: See the browser compatible page for successfully rendering the program.

Download this code

Ads