Share on Google+Share on Google+

HTML5 href, hreflang attribute of area tag.

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.

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

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.


The example for these attribute implementations are as follow:


<!DOCTYPE html >
  <title> Example For Area Tag href attribute </title>
  <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"/>


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.



Posted on: September 1, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.