Image map |
|
Elements |
|
An image with hot spots lets the user click on the hot spots,
to link to another page.
The |
|
Shape and dimensions |
|
Within an image, the dimensions are measured from the top left corner. Be careful that your hot spots do not overlap, and do not extend outside the image. This can produce unexpected results.
We will use dimensions to specify the hot spot areas.
For a rectangle, you specify the x and y coordinates of the top left corner of the hot spot,
followed by the x and y coordinates of the lower right corner of the hot spot.
For example, to get a rectangular hot spot with <area shape="rect" coords="100, 10, 140, 190"
For a polygon, you specify the x and y coordinates of each vertex of the hot spot,
in order around the polygon.
For example, to get an isosceles triangle hot spot with vertices <area shape="poly" coords="100, 10, 60, 190, 140, 190"
For a circle, you specify the x and y coordinates of the center of the hot spot,
and then the radius.
For example, to get a circle hot spot with center <area shape="circle" coords="100, 90, 60" |
|
Attributes and elements |
|
Let's look at all the elements and attributes needed to have an image map.
You need an
You need a
For each
|
|
Example |
|
picture of Cleo picture of Osage This image has hot spots, that are mapped as links. There are also text links under the image. |
|
The code for the image map shown above is: <img src="images/kit1.gif" height="288" width="481" alt="Cleo and Osage" usemap="#kit1" /> <map name="kit1"> <area shape="circle" coords="190,164,100" href="images/kit2.gif" alt="picture of Cleo" title="picture of Cleo" /> <area shape="rect" coords="300,94,480,230" href="images/kit5.gif" alt="picture of Osage" title="picture of Osage" /> </map> |
|
How do you find the coordinates, so the hot spots are where you want them? Check your coordinates to make sure your hot spots do not overlap, or extend outside the image. |
|