|
Image maps are images that allow you to link different parts of an image to seperate HTML files. They are useful in many different situations.
There are a few tags you need to know and understand before you can make a image map, they are all listed below, along with a detailed explaination of how we made our image map. These are all client-side image maps, server-side image maps require cgi and are slower when retrieving the page. Client-side maps are supported by most browsers 2.0 and above, so only a small percentage of the web will not be able to view these image maps. |
| Tag | Explanation |
| <MAP> </MAP> | Tells the browser that the following code is for an image map. |
| <IMG> | Used to insert images into web pages. | <AREA> | This tag is used to define the coordinates of an image map. |
|
Examples First off, we will show you how we made the image map seen on our page.
This is the code we used to make the above image map:
<IMG SRC="imagemap.gif" USEMAP="#imagemap" BORDER=0>
Here is a detailed explaination of exactly what each of those tags does:
<IMG SRC="imagemap.gif" USEMAP="#imagemap" BORDER=0>
<MAP NAME="imagemap">
<AREA SHAPE=RECT COORDS="129,5,170,24" HREF=java.html>
<AREA SHAPE=default HREF=index.html> Now that you understand what each part of image map does, you will learn how to define areas of your image. First off, you need to know how to find the coordinates of a certain part of your image. To do this, open your image in your graphics program and place your cursor over any area of the image, on the bottom of your screen you will see a set of numbers, a comma, and another set of numbers. Those define the coordinates of your image, width by height. There are three shapes you can use to distinguisht he "hot spots", they are rectangles, circles, and polygons.
Rectangles
That produces this image map:
Circles
As you can see, SHAPE attribute has changed from rect to circle, this is to let the users browser know that it is mapping a circle. The coordinates of the center of the circle always appear first, followed by the radius. Polygons
The third and final shape you can use to map an image is a polygon. It is used to make a hot spot out of a shape with more than four sides, like the image map below:
You can use differently shaped areas, like in the example above, in your image map, simply change the SHAPE attribute to the one you want and use the correct amount of coordinates. |