Pages

Advertisement

Monday, July 9, 2007

Image maps 101

To create precise link areas within a graphic on a web page, many web developers use image maps. If it's important to make your image maps compatible with a wide range of browsers, you should probably use server-side image maps, which require you to use both the ISMAP attribute of the IMG tag on the client side and to create a MAP file on the server side. For example, to supply a map file named MAPFILE.MAP for an image named IMAGE.GIF, you'd use the following HTML description


<A HREF="/directory/MAPFILE.MAP"><IMG SRC="IMAGE.GIF" ISMAP></A>

The map file itself is simply a text file that provides the attributes of the image map in question. For example, the map file definition

rect /OTHERPAGE.HTM 0,0 45,45

creates a rectangular hot spot on the image, starting in the upper-left corner and terminating at pixel location 45,45.

No comments: