The HTML usemap attribute
Quick answer
The HTML usemap attribute associates the element with a client-side image <map> by its name. It is used on the <img> element (an older use on <object> was dropped from the standard and is ignored by browsers).
Overview
The usemap attribute associates the element with a client-side image <map> by its name. It applies to the <img> element (an older use on <object> was dropped from the standard and is ignored by browsers).
Image maps are valid but rarely the best tool today; overlaid links or SVG are usually more flexible and accessible.
Syntax
<img src="map.png" usemap="#planets" alt=""><map name="planets"> … </map>
Values
| Value |
|---|
A hash-prefixed map name, e.g. #planets. |
Best practices
Frequently asked questions
What does the usemap attribute do?
Links an image to a client-side image map.
How do I make images responsive?
How do I stop images causing layout shift?
Which elements use the usemap attribute?
It is an element-specific attribute, used on the
<img> element. (Its old <object> use was removed from the standard.)