HTML Image Maps

Image maps are images with clickable areas (sometimes referred to as "hotspots") that usually link to another page.

If used appropriately, image maps can be an effective means for your users to find out more information about an item represented in the image. They can click different parts of the image to open a web page related to that part.

To create an image map:

Image Map Example

Try it

OK, compared to our previous lessons, this code is looking quite complex. However, once you study it, it is not that complex. All we are doing, is adding an image, then we are creating a map with coordinates. The hardest part is getting all the coordinates right.

In our example, we use the <area> tag in conjunction with the shape and coord attributes. These accept the following attributes:

shape

Defines a shape for the clickable area. Possible values:

  • default
  • rect
  • circle
  • poly
coords

Specifies the coordinates of the clickable area. Coordinates are specified as follows:

rect
left, top, right, bottom
circle
center-x, center-y, radius
poly
x1, y1, x2, y2, ...

You can use the above attributes to configure your own image map with as many shapes and clickable regions as you like.