HTML Image Maps

Image maps are images with clickable areas (sometimes referred to as "hotspots") that usually link to another page. If used tastefully, image maps can be really effective. If not, they can potentially confuse users.

To create an image map:

  1. First, you need an image. Create an image using the usual method (i.e. via an image editor, then save as a gif or jpeg into your website's image folder).
  2. Use the HTML <map> tag to create a map with a name. Inside this tag, you will specify where the clickable areas are with the HTML <area> tag
  3. Use the HTML <img> tag to link to this image. In the img tag, use with the usemap attribute to define which image map to use (the one we just specified).

Image Map Example


Mueller Hut, Mount Cook, and I Me Mount Cook Mueller Hut

OK, compared to our previous lessons, this code is looking quite complex. However, once you really study it, it is not that complex. All we are doing, is specifying 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:

shapeDefines a shape for the clickable area. Possible values:
  • default
  • rect
  • circle
  • poly
coordsSpecifies 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.

Enjoy this page?