HTML usemap Attribute

Beginner
5 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The usemap attribute on <img> associates the image with a <map> in the same document. That map holds <area> hotspots — a client-side image map.

The value is a hash-name reference: it must start with # and match the map’s name (for example usemap="#planet-map"). Contrast with ismap (server-side coordinates). Related: shape, coords, href, alt.

Baseline · Widely available.

Not deprecated on <img>. Client-side image maps are stable across modern browsers since about July 2015 (and long before).

usemap on <object> is obsolete.

Use <img usemap> for image maps. Do not put usemap on <object>.

HTML Syntax

syntax.html
<img usemap=" #map-name" …>

Pair with <map name="map-name">…</map>. In JavaScript, the IDL property is img.useMap (camelCase).

Attribute Values

One hash-name reference to a <map>:

Value / patternDescriptionTry it
#nameRequired form — fragment matching map nameTry it
With <area shape="rect">Rectangular hotspots via coordsTry it
With circle / polyOther hotspot shapesTry it
vs ismapClient HTML regions vs server ?x,yTry it
img.useMapRead or set the attribute from scriptTry it

Live Preview

Click a labeled region. Status shows which <area> you hit (links canceled for the demo).

Client-side map

Image uses usemap="#live-usemap". Coords match the intrinsic 256×256 image.

Map
HTML and CSS diagram — click a labeled regionHTML regionCSS region

Click a region on the image.

HTML Examples

Short, copy-ready snippets. Use Try It Yourself for a live editor.

Example 1 — Link an Image to a Map

Three rectangular zones on a simple diagram.

HTML
<img
  src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='150'%3E%3Crect width='100' height='150' fill='%2393c5fd'/%3E%3Crect x='100' width='100' height='150' fill='%2386efac'/%3E%3Crect x='200' width='100' height='150' fill='%23fcd34d'/%3E%3Ctext x='50' y='80' text-anchor='middle' font-size='14'%3EA%3C/text%3E%3Ctext x='150' y='80' text-anchor='middle' font-size='14'%3EB%3C/text%3E%3Ctext x='250' y='80' text-anchor='middle' font-size='14'%3EC%3C/text%3E%3C/svg%3E"
  width="300"
  height="150"
  alt="Three zones labeled A, B, and C"
  usemap="#zone-map">

<map name="zone-map">
  <area shape="rect" coords="0,0,100,150" href="#a" alt="Zone A">
  <area shape="rect" coords="100,0,200,150" href="#b" alt="Zone B">
  <area shape="rect" coords="200,0,300,150" href="#c" alt="Zone C">
</map>
Try It Yourself

How It Works

  1. Put usemap="#zone-map" on the image.
  2. Define <map name="zone-map"> — names must match (with # only on usemap).
  3. Add <area> children with shape, coords, href, and alt.
  4. Coords use image pixels — based on the image’s intrinsic size.

Example 2 — Circle Hotspots

shape="circle" uses coords="x,y,radius".

HTML
<img
  src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='150'%3E%3Ccircle cx='75' cy='75' r='60' fill='%2393c5fd'/%3E%3Ccircle cx='225' cy='75' r='60' fill='%2386efac'/%3E%3Ctext x='75' y='80' text-anchor='middle' font-size='14'%3EJS%3C/text%3E%3Ctext x='225' y='80' text-anchor='middle' font-size='14'%3ECSS%3C/text%3E%3C/svg%3E"
  width="300"
  height="150"
  alt="Two circles labeled JS and CSS"
  usemap="#circle-map">

<map name="circle-map">
  <area shape="circle" coords="75,75,60" href="/javascript" alt="JavaScript">
  <area shape="circle" coords="225,75,60" href="/css" alt="CSS">
</map>
Try It Yourself

How It Works

  1. shape="circle" — round hotspot.
  2. coords="x,y,r" — center and radius in image pixels.
  3. Same usemap rule — still # + map name.
  4. Use poly for irregular shapes (list of x,y pairs).

Example 3 — usemap vs ismap

Client regions in HTML vs sending click coordinates to the server.

HTML
<!-- Preferred: client-side map -->
<img src="/images/area-example.png" alt="Diagram" width="256" height="256"
  usemap="#planet-map">
<map name="planet-map">
  <area shape="rect" coords="111,1,253,98" href="/html" alt="HTML">
  <area shape="rect" coords="74,148,253,250" href="/css" alt="CSS">
</map>

<!-- Legacy-style server map: image inside a link + ismap -->
<a href="/hit-test">
  <img src="/images/area-example.png" alt="Server map demo" width="256" height="256" ismap>
</a>
Try It Yourself

How It Works

  1. usemap — browser uses <area> links in the document.
  2. ismap — click appends ?x,y to the parent link’s URL.
  3. Prefer usemap for accessible, self-contained regions.
  4. Read img.useMap in script if you need to toggle maps dynamically.

Edge Cases & Pitfalls

Most bugs are a missing #, wrong map name, or coords that no longer match a resized image.

hash

Must start with #

usemap="planet-map" is wrong. Use usemap="#planet-map" to match name="planet-map".

coords

Coords are for intrinsic size

If CSS scales the image, hotspots can drift. Keep display size equal to width/height, or recalculate coords.

a11y

Provide alt on every area

Linked regions need text alternatives. Also give the img a clear alt.

object

Not on <object>

usemap on object is obsolete. Use img for client-side maps.

nav

Prefer real links when possible

Image maps are harder to maintain than a list of text links. Use maps for true spatial diagrams.

Browser Support

usemap on <img> is a core HTML attribute for client-side image maps. It is not a Node.js, Deno, or Bun API.

✓ Baseline · Widely available

usemap

Supported in all major browsers for decades. Pair with map and area; keep coordinates aligned with the image’s intrinsic size.

97% Global support (approx.)
Google Chrome 1+
Full support
Mozilla Firefox 1+
Full support
Apple Safari 1+
Full support
Microsoft Edge 12+
Full support
Opera 4+
Full support
Samsung Internet Modern · Full
Full support
Internet Explorer 1+
Supported
usemap Widely supported

Bottom line: Safe to use on img for diagrams and spatial nav. Prefer usemap over ismap for new work, and skip usemap on object.

Key Takeaways

  • Role: attach an img to a client-side <map>.
  • Value: #map-name matching <map name>.
  • Hotspots: <area> with shape, coords, href, alt.
  • Prefer over ismap for new, accessible maps.

One line: usemap="#name" connects an image to a <map> of clickable <area> regions defined in HTML.

Frequently Asked Questions

On an img, usemap points to a <map> in the same document. That map holds <area> elements that define clickable regions (client-side image map). The value is a hash-name reference such as #planet-map.
Use usemap on <img> for new work. usemap on <object> is obsolete — use img for image maps instead.
Write usemap="#name" on the image and name="name" on the map (no spaces). If the map also has an id, name and id should be the same value.
usemap defines regions in HTML with map/area. ismap is a server-side map: the image must be inside a link and click coordinates are sent as ?x,y. Prefer usemap for new pages.
Yes. Each area that is a link should have an alt describing the destination, just like linked images need meaningful alt.
No. Client-side image maps with usemap on img are Baseline widely available. Avoid usemap on object (obsolete), and prefer plain links when a simple nav will do.

Next: valign

Legacy vertical alignment on table cells — and what to use instead.

valign tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful