This <map> 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.
<map> |
Yes | Yes | Yes | Yes | Yes |
None.
Attribute | Value | Description |
---|---|---|
name | mapname | Required. Set the name of an image-map |
The <map> tag supports the Global Attributes in HTML.
The <map> tag supports the Event Attributes in HTML.
map { display: inline; }
A demo showing how to use <map> tag.
<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><!--from ww w . j a va 2 s .co m-->
</html>