Search the Whole World Here.,.,

Image Maps

Image Maps


Use the map tag to define an image-map. An image-map is an image with clickable areas.

The name attribute of the map tag is associated with the img's usemap attribute and creates a relationship between the image and the map.

The map tag contains a number of area tags, that defines the clickable areas in the image-map:

Example

<img src="planets.gif" alt="Planets" usemap="#planetmap" style="width:145px;height:126px;">

<map name="planetmap">
  <area shape="rect" coords="0,0,82,126" alt="Sun" href="sun.htm">
  <area shape="circle" coords="90,58,3" alt="Mercury" href="mercur.htm">
  <area shape="circle" coords="124,58,8" alt="Venus" href="venus.htm">
</map>
Try it Yourself »

Image Floating

Image Floating


Use the CSS float property to let the image float to the right or to the left of a text:

Example

<p><img src="smiley.gif" alt="Smiley face" style="float:right;width:42px;height:42px;">
The image will float to the right of the text.</p>

<p><img src="smiley.gif" alt="Smiley face" style="float:left;width:42px;height:42px;">
The image will float to the left of the text.</p>
Try it Yourself »

Using an Image as a Link

Using an Image as a Link


To use an image as a link, simply nest the img tag inside the a tag:

Example

<a href="default.asp">
  <img src="smiley.gif" alt="HTML tutorial" style="width:42px;height:42px;border:0;">
</a>
Try it Yourself »
Note: border:0; is added to prevent IE9 (and earlier) from displaying a border around the image (when the image is a link).
Animated Images

Animated Images


The GIF standard allows animated images:

Example

<img src="programming.gif" alt="Computer Man" style="width:48px;height:48px;">
Try it Yourself »

Note that the syntax of inserting animated images is no different from non-

animated images.
Images on Another Server

Images on Another Server


Some web sites store their images on image servers.

Actually, you can access images from any web address in the world:

Example

<img src="http://www.w3schools.com/images/w3schools_green.jpg" alt="W3Schools.com">
Try it Yourself »

Ads by Google