HTML5 href, hreflang attribute of area tag.


 

HTML5 href, hreflang attribute of area tag.

Use of href, hreflang attribute of area tag in HTML5.

Use of href, hreflang attribute of area tag in HTML5.

HTML5 <area> href, hreflang attribute.

In this tutorial we will discuss the implementation and use of  href, hreflang attributes of the <area> tag in html5.

href:
The href attribute specifies the URL link for the area tag in the image map; each tag have a link.

hreflang:
This attribute specifies the basic language code of the URL resource i.e. language code of linked document. This attribute is used only when the href attribute is used in the element.

Declaration syntax:

The syntax for both the attributes are:

<area  href="URL"  hreflang="value" />

The attribute value refers to the language code, which is two letter code for specifying the language of the linked document. e.g. en  for English, hi for Hindi etc.

There is no difference between html4.0 and html5 href, hreflang attribute.

Example:

The example for these attribute implementations are as follow:

href_attribute_of_area_tag.html

<!DOCTYPE html >
<html>
 <head>
  <title> Example For Area Tag href attribute </title>
 </head>
 <body>
  <img src="comp.gif" width="350" height="299"  usemap="#computermap" />
     <map name="computermap">
      <area  coords="16, 78, 123, 242"  href="hreflang.html" shape="rect"  hreflang="en" />
    <area  coords="138, 90, 303, 239"  href="hreflang.html" shape="rect"  hreflang="en"/>
      <area  coords="70, 244, 324, 290" href="hreflang.html" shape="rect"  hreflang="en"/>
     </map>
 </body>
</html>

Output.

We can see the output by clicking on the image given below.

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

Download This Example.

Ads