HTML - attributes - hreflang

revision:


Content

"hreflang" : specifies the language of the linked document syntax some examples


"hreflang" : specifies the language of the linked document

top

This attribute is only used if the href attribute is set, i.e. the hreflang attribute requires that href has a value.

Note: This attribute is purely advisory.

Applicable elements: <a>, <area>, <link>.


syntax

top

<a hreflang="language_code"></a>

language_code: a two-letter language code that specifies the language of the linked document.

The first two characters in the "hreflang value" represents the language code, such as 'en'. The last two characters in the "hreflang value" represents the country code, such as 'US'.


some examples

top

my website

codes:
                    <p class="spec"><a hreflang="en" href="https://www.lwitters.com">my website</a></p>
                
Computer Monitor Keyboard Mouse
codes:
                    <img src="../../pics/computer-map.png" alt="Computer" usemap="#computermap">
                    <map name="computermap">
                    <area hreflang="en-US" shape="rect" alt="Monitor" coords="253,142,16,2" 
                            href="https://www.google.com/search?q=monitor" target="_blank">
                    <area hreflang="en-US" shape="rect" alt="Keyboard" coords="262,218,0,156" 
                            href="https://www.google.com/search?q=keyboard" target="_blank">
                    <area hreflang="en-US" shape="circle" alt="Mouse" coords="267,234,22" 
                            href="https://www.google.com/search?q=mouse" target="_blank">
                    </map>