Image Map Notes
Image Map Notes
An image map is a technique in which a user can click anywhere inside of an image, and the location of
the click affects the outcome of the click. The idea is that clicking on different sections of the image
creates different effects.
For example, the image might be a map of the United States, and clicking within the borders of a
particular state leads to a page about that state.
An image map is an image with clickable areas.
The areas are defined with one or more <area> tags.
The HTML <map> tag defines an image map.
The idea behind an image map is that you should be able to perform different actions depending on
where in the image you click.
Tag Description
Try to click on the computer, phone, or the cup of coffee in the image below:
Example
Here is the HTML source code for the image map above:
<map name="workmap">
<area shape="rect" coords="34,44,270,350" title="computer" href="computer.htm">
<area shape="rect" coords="290,172,333,250" title="phone" href="phone.htm">
<area shape="circle" coords="337,300,44" title="coffee" href="coffee.htm">
The usemap value starts with a hash tag # followed by the name of the image map, and is used to create a
relationship between the image and the image map.
The <map> element is used to create an image map, and is linked to the image by using the
required name attribute:
<map name="workmap">
The name attribute must have the same value as the <img>'s usemap attribute .
The Areas
Then, add the clickable areas.
Shape
You must define the shape of the clickable area, and you can choose one of these values:
Shape="rect"
The coordinates for shape="rect" come in pairs, one for the x-axis and one for the y-axis.
So, the coordinates 34,44 is located 34 pixels from the left margin and 44 pixels from the top:
The coordinates 270,350 is located 270 pixels from the left margin and 350 pixels from the top:
Example
<area shape="rect" coords="34, 44, 270, 350" href="computer.htm">
Shape="circle"
To add a circle area, first locate the coordinates of the center of the circle:
337,300
44 pixels
Example
<area shape="circle" coords="337, 300, 44" href="coffee.htm">
This is the area that becomes clickable and will send the user to the page "coffee.htm":
Shape="poly"
The shape="poly" contains several coordinate points, which creates a shape formed with straight lines (a
polygon).
In the server-side method, when you click an image leading to multiple links, you are actually invoking a server side
program (ex- cgi-bin,php,etc program). The program typically reads a separate map file that tells the program where
to go, depending on what part of the image you are clicking. The program returns the destination to the web browser,
which then opens the page.
The imagemap is called "server-side" because the web browser must contact the remote host to find which site to
contact.
In Client-side imagemaps, rather than requiring the program on the remote host to determine what site to access,
the web browser itself associates regions of the image with the local sites
The ismap attribute in an img tag creates a server-side image map: The browser sends the coordinates
of the clicked point to the server.
<a href="click_on_world_map.php" target="_self">
<img src="world_map.png" ismap> <!-- Noncompliant -->
</a
On the other hand, client-side image maps, which use the usemap attribute allow for each clickable area
to specify an alternate text, enabling accessibility for the blind.
<DIV>
HTML <div> tag is used to divide the web page into different divisions or parts.
There are five attributes you can use with div tag:
o id
o width
o height
o title
o style
<html>
<head>
<style type=text/css>
.one{
background-color:orange;
}
.two{
background-color:yellow;
</style>
</head>
<body>
<p> Div tag is used for group many HTML tag like table, list, paragraph
in web page.
Mostly div tag used in empty web page to partition or make section for
</div>
<div class="two">
<p> To make section of required data or content multiple div tags are
used in container.
Example: header, footer, navigation bar, table, images, texts etc. </p>
</div>
</body>
</html>
Output:
<body>
<h1> The <div> Tag </h1>
<div style="background-color:#8ebf42">
<p>We use the <div> tag to group two paragraphs for applying a background to the text, and to add color to
this
<span style="color:#1c87c9">word</span> we place it within <span> tag.</p>
<p> Pay attention, that the <div> tag is a block-level element, so a line break is placed before and after
it.</p>
</div>
</body>
Pay attention, that the <div> tag is a block-level element, so a line break is placed
before and after it.
HTML div element is used to wrap HTML span element is used to wrap
large sections of elements. small portion of texts, image etc.