English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
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>.
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 ‹/›
IEFirefoxOperaChromeSafari
All major browsers support the usemap attribute.
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.
None.
<img usemap="#mapname">
Value | Description |
---|---|
#mapname | A hash character (#) followed by the name or id of the <map> element to be used. |