Image Maps

Check your book for more details.

Image Maps allow you to define sections of an image that become different clickable links. Essentially, you graph out(map) the X and Y coordinates of the image and define what regions link to what subpages. An image map can be client-side or server-side. Server-side means that the program to run the image map resides on the server. This requires a scripting language such as Perl to create. In this class, we will focus on client-side image maps.

Client-side image maps are coded into the HTML document and therefore reside on the user's(clients') computer. They are quicker and simpler to create. You can use image-mapping software to create the image map or you can do it by hand-coding. Guess which we will do in this class??

Let's say for example that I had the lovely image of the 3 Stooges and I wanted each face to be a clickable link to a webpage on that particular Stooge. It looks like a regular image, but when the user moves his/her mouse over the face is changes to a finger signifying a clickable link. One of the problems with image maps for the user is how do they know if it's an image map or just an image if they don't move their mouse. Some image maps are obviously clickable. The image to the right from Volkswagon's first homepage has clickable regions such as the little car or the phone(Image to right is not currently an image map.). However, where the link takes you is not as obvious. With some images(like the 3 Stooges below) you may need to tell your user this is a clickable image.

Hey Buddy, Click My Face!!

Image mapping is really quite easy and allows you to be creative. My main caution is don't be so creative you fool your user. Make it obvious that the image you are using is clickable.

The entire code for the 3 Stooges image map is shown in the table below, both the yellow and white text. Do not click on the yellow, underlined text. But, if you hold your mouse over the yellow text, you can read a description of what that section codes in the bottom of your browser window.

3 Stooges Image Map
<map name="faces">
<area shape="circle" coords="49,69,60" href="moe.htm">
<area shape="circle" coords="138,65,60" href="curly.htm">
<area shape="circle" coords="223,66,60" href="larry.htm">
</map>
<img src="stooges.gif" usemap="#faces" border=0>

Note: I used the "circle" shape for these clickable regions because the stooges heads are so perfect!! The two other approved shape types are rectangle and polygon. I never use rectangle because I cannot get it to work in Netscape. For any non-circular object, I use shape="poly" and list the x,y coordinates that trace the shape that I want clickable. The code for the Stooges image map if I used polygons is below. Don't type the x or y, just the pixel numbers of the coordinates.

3 Stooges Image Map(using "poly")
<map name="faces">
<area shape="poly" coords="x1,y1,x2,y2,x3,y3,etc." href="moe.htm">
<area shape="poly" coords="x1,y1,x2,y2,x3,y3,etc." href="curly.htm">
<area shape="poly" coords="x1,y1,x2,y2,x3,y3,etc." href="larry.htm">
</map>
<img src="stooges.gif" usemap="#faces" border=0>


Index Basic Tags Links Design Layout Tables Image File Types Using Images Image Editing Lists Frames