An Image Map allows you to define areas of an image that act like a link so that when the user clicks on an area the browser loads the target webpage or media file. Image maps are an excellent way to provide metaphorical navigation or to call out the nomenclature of an object. This article shows you how to code simple and complex images maps.
Welcome to Bucaro TecHelp!

Welcome to Bucaro TecHelp!
Maintain Your Computer and Use it More Effectively
to Design a Web Site and Make Money on the Web

[About BTH]  [User Agreement]  [Privacy Policy]  [Site Map]  [Contact Form]  [Advertise on BTH]  [News Feed]

Google
Web
This Site
Your Ad Here!
Your ad here for one full year, only $20. Send me your ad copy, up to six lines, I'll post it ASAP. After you inspect your ad online, you can pay through PayPal.
Click here for more information.

Image Map Basics

An Image Map allows you to define areas of an image that act like a link so that when the user clicks on an area, the browser loads the target webpage or media file. The areas defined do not have to be the same size or shape.

The first step to create an image map is to create or select the image that will be used for the map. Below is an image showing the three basic shapes defined for image maps; rect, circle, and poly.

rect circle poly

The second step is to define the coordinates of the areas associated with each link. If the square shown below represents the image, the origin (x=0 y=0) of the image is in the upper-left corner. X values increase as you move to the right across the image and Y values increase as you move to the bottom of the image.

Coordinates

- The easiest way to determine the coordinates of an area is to load the image into Windows Paint program, or your favorite graphics editing application, then place your mouse pointer over each point in the image for which you want coordinates, and view the coordinates of that point in the status bar.

Shown below is the code for the example image map. Note that, the code for the map containing the tags that define the areas must come first in the code before the code that loads the image that uses the map.

<map name="testmap">
<area shape="rect" coords="10,10,40,40" alt="rect" href="page1.htm">
<area shape="circle" coords="65,30,15" alt="circle" href="page2.htm">
<area shape="poly" coords="90,40,120,10,150,40,90,40" alt="poly" href="page3.htm">
</map>

<img border=0 width=160 height=50 src="testmap.gif" usemap="#testmap">

Below are the html tags and their attributes.

    <map>
  • Attributes:
    • name     Name referenced by USEMAP
    <area>
  • Attributes:
    • shape     The shape of the clickable area. values: rect, circle, poly
    • coords     Coordinates of the clickable area
      • rect:     left-x, top-y, right-x, bottom-y
      • circle:     centerX, centerY, radius
      • poly:     x1,y1,x2,y2, ... xn,yn
    • alt     Tooltip text
    • href     URL to load when the area is clicked

- Note that the meaning of the values in the coords attribute depends upon the shape specified in the shape attribute.

Web Design Sections

RSS Feed RSS Feed

HTML Design

[Site User Agreement]  [Advertise on This site]  [Search This Site]  [Contact Form]
Copyright©2001-2007 Bucaro TecHelp P.O.Box 18952 Fountain Hills, AZ 85269