English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML Tag大全

HTML: <img> usemap Attribute

The usemap attribute specifies an image as a client-side image map (an image map is an image with clickable areas), and the usemap attribute is associated with the name attribute of the <map> element, creating a relationship between <img> and <map>.

 HTML <img> tag

Online example

Image map with clickable areas:

<!DOCTYPE html>
<html>
<head>
<title>HTML:<img> usemap 属性 - 基础教程网 oldtoolbag.com</title>
<body>
<img src="planets.gif" width="145"height="126"alt="Planets" usemap="#planetmap">
<map name="planetmap">
  <area shape="rect" coords="0,0,82,126"alt="Sun" href="sun.html">
  <area shape="circle" coords="90,58,3"alt="Mercury" href="mercur.html">
  <area shape="circle" coords="124,58,8" alt="Venus" href="venus.html">
</map>
</body>
</html>
Test and see ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

All major browsers support the usemap attribute.

Definition and Usage

The usemap attribute specifies an image as a client-side image map (an image map is an image with clickable areas).

The usemap attribute is related to<map>The name attribute of the element is associated with the <img> and <map> to create a relationship.

Note: The usemap attribute cannot be used if the <img> element is a descendant of an <a> or <button> element.

HTML 4.01 and HTML5differences between

None.

Syntax

<img usemap="#mapname">

Attribute value

ValueDescription
#mapnameA hash character (#) followed by the name or id of the <map> element to be used.
 HTML <img> tag