The name attribute on a <map> tag assigns a name to that map element.
This name is used by the image to reference the map.
A name attribute on a <map> element.
The name is used by the image to reference the image map.
<img src="/img/html/computer-map.png" alt="Computer" usemap="#computermap">
<map name="computermap">
<area shape="rect" coords="253,142,16,2" alt="Computer" href="javascript:alert('Computer screen was clicked');">
<area shape="rect" coords="262,218,0,156" alt="Keyboard" href="javascript:alert('Computer keyboard was clicked');">
<area shape="circle" coords="267,234,22" alt="Mouse" href="javascript:alert('Computer mouse was clicked');">
</map>
The name attribute assigns a name to the image map.
This name helps establishing a relationship between the image and the image map.
The image uses the usemap attribute to reference the map's name.
<map name="mapname">
Value | Description |
---|---|
mapname | String value that is the name of the image map. |
Here is when name support started for each browser:
Chrome
|
1.0 | Sep 2008 |
Firefox
|
1.0 | Sep 2002 |
IE/Edge
|
1.0 | Aug 1995 |
Opera
|
1.0 | Jan 2006 |
Safari
|
1.0 | Jan 2003 |