<map>

Description

This element is used to specify the coordinates of an image map in the page. You must use this element in conjunction with the <img> element and the <area> element.

<img> defines where is the image. <area> defines what is the coordinates.

Example


<html>
<body>
     <img src="http://java2s.com/style/download.png" 
          alt="Demo image" 
          width=200 
          height=100 
          usemap="#myMap">
     <map name="myMap">
          <area shape="rect" 
                coords="0, 0, 100, 50" 
                href="http://www.w3c.com">
          <area shape="rect" 
                coords="100, 0, 200, 50"
                href="http://www.microsoft.com">
          <area shape="rect" 
                coords="0, 50, 100, 100" 
                href="http://www.msn.com">
          <area shape="rect" 
                coords="100, 50, 200, 100"
                href="http://www.yahoo.com">
     </map>
</body><!--  ww  w  . ja v  a 2s . co m-->
</html>

Click to view the demo

The code above generates the following result.

map




















Home »
  HTML CSS »
    HTML CSS Reference »




HTML Tag Reference
CSS Reference
CSS Selector Reference
Encoding Reference