Html Image Maps

Html Image Maps
Published on 2021-07-01 16:45:16
Tag/Attribute Value
<img> Below are the image map-specific attributes to use with <img>. Regular <img> attributes apply.
use map The name of the map with a hash symbol prepended to it. For example, for a map with name="map", the image should have usemap="#map".
<map> name The name of the map to identify it. To be used with the image's usemap attribute.
<area> Below are <area>-specific attributes. When href is specified, making the <area> a link, <area> also supports all of the attributes of the anchor tag (<a>) except ping. See them at the MDN docs.
alt The alternate text to display if images are not supported. This is only necessary if href is also set on the <area>.
coords The coordinates outlining the selectable area. When shape="polygon", this should be set to a list of "x, y" pairs separated by commas (i.e., shape="polygon" coords="x1, y1, x2, y2, x3, y3, ..."). When shape="rectangle", this should be set to left, top, right, bottom. When shape="circle", this should be set to centerX, centerY, radius.
href The URL of the hyperlink, if specified. If it is omitted, then the <area> will not represent a hyperlink.
shape The shape of the <area>. Can be set to default to select the entire image (no coords attribute necessary), circle or circ for a circle, rectangle or rect for a rectangle, and polygon or poly for a polygonal area specified by corner points.


Introduction to Image Maps


An image map is an image with clickable areas that usually act as hyperlinks. The image is defined by the <img> tag, and the map is defined by a <map> tag with <area> tags to denote each  clickable area. Use the use map and name attributes to bind the image and the map.

Basic Example

To create an image map so that each of the shapes in the image below are clickable:

The code would be as follows:

<!DOCTYPE html>
  <title>Atutorialhub demo title</title>
  <img src="" usemap="#shapes">
  <map name="shapes">
    <area shape="polygon" coords="79,6,5,134,153,134">
    <area shape="rectangle" coords="177,6,306,134">
    <area shape="circle" coords="397,71,65"></map>



ATutorialHub Related Guide

HTML Tutorials Comments (9)

Leave a Comment

Your email address will not be published. Required fields are marked*

User Comments

html tutorial comments

panduranga gupta

2021-07-05 07:03:13

good website for learning and help me a lot

html tutorial comments


2021-09-25 14:58:47

The awsome website i am looking like for a long time, good work atutorialhub team keep doing

html tutorial comments


2021-09-01 15:03:56

Learning a lot from the courses present on atutorialhub. The courses are very well explained. Great experience

html tutorial comments


2021-09-10 15:05:45

It is very helpful to students and easy to learn the concepts

html tutorial comments


2021-09-14 15:06:41

Great job Tutorials are easy to understand Please make use of it

html tutorial comments

Zain Khan

2021-09-18 15:07:23

Great content and customized courses.

html tutorial comments

Rudrakshi Bhatt

2021-09-09 15:08:10

Well structured coursed and explained really well!

html tutorial comments

Pavana Somashekar

2021-09-11 15:09:08

Good platform for beginners and learn a lot on this website

html tutorial comments


2021-09-25 19:35:50

Nice website