HTML <map>
Tag
Example
An image map with clickable areas:
Browser Support
Most browsers currently support the <map>
tag.
Tag Definition and Usage
The <map>
tag is used for client-side image maps. An image map is an image with clickable areas.
The usemap
attribute in <img>
can reference the id
or name
attribute of <map>
(depending on the browser), so we should add both id
and name
attributes to <map>
.
The area
element is always nested inside the <map>
element. The area
element defines a region in the image map.
Differences Between HTML 4.01 and HTML5
Note: In HTML5, if the id
attribute is specified in the <map>
tag, you must also specify the name
attribute.
Differences Between HTML and XHTML
In XHTML, the name
attribute is deprecated and should be replaced with the id
attribute.
Attributes
Attribute | Value | Description |
---|---|---|
name | mapname | Required. Specifies the name of the image-map. |
Global Attributes
The <map>
tag supports global attributes. See the full list of HTML Global Attributes.
Event Attributes
The <map>
tag supports all HTML Event Attributes.