| Home > Computer & I'net > Image Maps... |
|
|
|||||||||||||||
|
|
|||||||||||||||
|
||||||||||||||||
Image Maps | ||||||||||||||||
We also offer a "fake" image map tutorial. This shows how to put separate linked images into place, thus creating a similar affect of a real image map. An image map is a single image with link areas. The link areas (also known as hotspots) link to different areas, pages, or sites like any regular link. Each hotspot can be assigned a different destination. A hotspot of an image map can be 1 of 4 different shapes. Circle, Rectangle, Polygon, and Default. With each shape, a set of co-ordinates are needed. The shapes and co-ordinates are invisible. They will not actually be seen on the image itself. They create references. The examples shown in this tutorial are shaded to visually see what is happening. Co-ordinates are the numbers that represent exactly where a point is on the image. If you take a look at a road map, you will see the grid all through it sectioning it into squares. Or how about the game of BattleShip? Those are all co-ordinates. See, you know all about co-ordinates already and weren't aware of it! Here are the co-ordinates needed to specify the different shapes of an image map:
The X co-ordinates are the pixel count from the left border of the image. Cute isn't it? Yeah, I know it's bad, but it will help explain image mapping. This image happens to be 200 pixels wide and 175 pixels heigh in size. CIRCLE So, the sun is going to become the hotspot for this example. By opening my image in an image editor, I found that the center of the sun circle is located about 42x42. The radius is about 30 pixels. The full co-ordinates for this AREA are 42,42,30. To put that into coding it would look like :
RECTANGLE This is probably the most common shape used. The main house area is the hotspot this time. Opening the image in an image editor, I found the top left point is at 82x99 and the bottom right point is at 143x157. The full co-ordinates for this AREA are 82,99,143,157. To put that into coding it would look like :
POLYGON The roof is going to be the hotspot. Opening the image in an image editor, the bottom left corner is at 83x99, the top is at 109x64, and the last corner is at 139x99. Putting them all together you get 83,99,109,64,139,99. Putting that into coding would look like :
DEFAULT
You are now half ready to create an image map! All you need now is a bit more HTML coding to put it all together. Here is the basic outline of an image map with 3 hot spots and the rest of the image as non-active. Like all other images, this code will go into the BODY area of your coding.
The hotspots are contained in a MAP tag set. The MAP tag is used to assign a to this group for referencing. In the IMG tag, the USEMAP property is added to reference the image map. The # in the USEMAP means to "reference" the MAP co-ordinates in the grouping (in this case) called MyMap. ----------------- Article by David Stanley. Visit his site http://www.htmlite.com. Reprinted with permission. | ||||||||||||||||
| Articles |
•Auto & Trucks•Business•Computer & I'net·General·Apache·CSS·Database·HardwareHTML·Javascript&DHTML·Linux·MySQL·Operating System·Perl / CGI·PHP·Programming·Publishing·Search Engines·Software Problems·SSI·Tips & Tricks·Utilities·Web Design•Family•Food & Drink•Gardening•Health•Other•Pets•Psychology•Spiritual•Travel•Women |
| Calculators |
|