map
Definition and Usage
The HTML<map>
element is used with <area> to define an image map (a clickable link area) along with <img> tag. The <map> tag is used to define a client-side image-map. An image-map is an image with clickable areas.
The required name attribute of the <map> element is associated with the <img>'s usemap attribute and creates a relationship between the image and the map.
Image maps are images that have clickable areas (sometimes referred to as "hot spots"). Each of these clickable areas can lead to a different location. Therefore, an image map could potentially have many links that lead to many different URLs. To create an image map, you use the <map>
tag to declare the image map, and the <area> tag (nested within the <map>
tag) to define the clickable areas. The <img> tag can be defined elsewhere on the page, and is linked to the <map>
element using the name
attribute.
There are three HTML elements used to create image maps:
Syntax
The<map>
tag is typically written like this <map name="">
</map>
with the <area> tag nested between the start and end tags. The name
attribute is used by an <img> elements that use this particular image map.