Latest web development tutorials

HTML <map> tag

Examples

With clickable image map area:

<img src="planets.gif" width="145" height="126" alt="Planets" usemap="#planetmap">

<map name="planetmap">
<area shape="rect" coords="0,0,82,126" href="sun.htm" alt="Sun">
<area shape="circle" coords="90,58,3" href="mercur.htm" alt="Mercury">
<area shape="circle" coords="124,58,8" href="venus.htm" alt="Venus">
</map>

try it"

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Most browsers support <map> tag.


Tag definitions and instructions

<Map> tag for client-side image maps. Image refers to an image mapping with clickable areas.

<Img> attributes can be referenced in usemap <map> The id or name attribute (depending on the browser), so we should at the same time to <map> add id and name attribute.

area element is always nested inside the map element. area elements define the image map area.


Differences between HTML 4.01 and HTML5

Note: In HTML5, if the id attribute is specified in the <map> tag, then you must also specify the name attribute.


Differences between HTML and XHTML

In XHTML, name attribute is deprecated, use the id attribute to replace it.


Attributes

属性 描述
name mapname 必需。为 image-map 规定的名称。


Global Properties

<map> tag supports the global attributes, view complete the property sheet HTML Global Attributes .


Event Properties

<map> tag supports all HTML event attributes .