HTML usemap Attribute

Beginner
⏱️ 6 min read
📚 Updated: Jun 2026
🎯 3 Examples
Images & Maps

Introduction

The usemap attribute is a powerful HTML feature for creating client-side image maps. It connects an image (or object) to a <map> element so you can define clickable regions — each linking to a different URL.

Image maps are useful for diagrams, floor plans, infographics, and navigation graphics where different parts of one image should go to different pages. Each hotspot is an <area> inside the map.

What You’ll Learn

01

#mapName

Hash reference.

02

map + area

Hotspot markup.

03

Shapes

rect, circle, poly.

04

coords

Pixel positions.

05

JavaScript

useMap prop.

06

Accessibility

alt on areas.

Purpose of usemap

The primary purpose of the usemap attribute is to connect an image with a client-side image map. It is applied to <img> (most common) or <object> and references a corresponding <map> element where clickable <area> regions are defined.

Without usemap, the image is a single link at most. With it, you can turn one graphic into a multi-link navigation surface.

💡
Client-side vs server-side maps

usemap creates a client-side map in HTML. Older server-side image maps (ISMAP) are obsolete. Modern pages use HTML <map> + <area>.

📝 Syntax

Set usemap on the image and define matching name on <map>:

usemap.html
<img src="diagram.png" alt="Site map" usemap="#siteMap">

<map name="siteMap">
  <area shape="rect" coords="0,0,100,80" href="/home" alt="Home section">
</map>

Syntax Rules

  • Value format: #mapName — hash plus the name on <map>.
  • The map can appear before or after the image in the document.
  • Each <area> needs shape, coords, and usually href + alt.
  • Coordinates are in pixels relative to the image’s intrinsic (natural) size.
  • JavaScript property: HTMLImageElement.useMap (same hash string).
  • Responsive images: coords do not auto-scale; recalculate or prefer SVG links for complex responsive layouts.

💎 Values

The usemap attribute accepts a hash-name reference pointing to a <map> element:

  • #mapName — Must match name="mapName" on the <map> element.
  • The hash (#) is required in the attribute value.
  • Case sensitivity follows document rules; use consistent naming (e.g. worldMap).
usemap-value.html
<img src="example.jpg" alt="Example Image" usemap="#exampleMap">
<map name="exampleMap">
  <!-- area elements defined here -->
</map>

How It Works

In this pattern, usemap="#exampleMap" tells the browser to use the map named exampleMap. Clicks inside defined <area> regions follow each area’s href.

⚡ Quick Reference

PartAttribute / valueRole
Imageusemap="#myMap"Links image to map
Mapname="myMap"Named target for usemap
Rectangleshape="rect" coords="L,T,R,B"Box hotspot
Circleshape="circle" coords="X,Y,R"Round hotspot
Polygonshape="poly" coords="x1,y1,x2,y2,..."Custom shape
JavaScriptimg.useMap = "#otherMap"Switch active map

Applicable Elements

ElementSupported?Typical use
<img>YesMost common — clickable photo or diagram
<object>YesImage maps on embedded image content
<input type="image">YesImage submit button with hotspots
<map>N/ADefines areas; referenced by usemap
<area>N/AChild of map; each hotspot link

Image map vs single link vs SVG

ApproachBest forNotes
usemap + <map>Raster images (PNG, JPG)Classic HTML; fixed pixel coords
One <a> wrapping <img>Single destinationSimpler; whole image is one link
Inline SVG with <a>Scalable vector graphicsBetter for responsive multi-link diagrams
CSS positioned linksOverlays on imagesFlexible layout; more manual work

Examples Gallery

Build a three-zone image map, switch maps with JavaScript, and use rect, circle, and polygon shapes.

👀 Live Preview

Minimal image map linking two rectangular regions on one image:

West and East zonesWest regionEast region

Example

A world-map style layout with two rectangular regions (extend with more <area> elements as needed):

usemap.html
<img src="world-map.jpg" alt="World Map" usemap="#worldMap">
<map name="worldMap">
  <area shape="rect" coords="0,0,100,100" href="north-america.html" alt="North America">
  <area shape="rect" coords="100,0,200,100" href="europe.html" alt="Europe">
</map>

How It Works

usemap="#worldMap" connects the image to the map named worldMap. Each <area> defines a rectangle with coords as left,top,right,bottom in pixels.

Dynamic Values with JavaScript

Switch which map is active when the user clicks a button:

dynamic-usemap.html
<button type="button" onclick="updateMap()">Change Map</button>
<img id="dynamicImage" src="diagram.png" alt="Dynamic Map" usemap="#defaultMap">

<map name="defaultMap">...</map>
<map name="dynamicMap">...</map>

<script>
  function updateMap() {
    document.getElementById("dynamicImage").useMap = "#dynamicMap";
  }
</script>

How It Works

Clicking Change Map runs updateMap(), which sets useMap to #dynamicMap. The same image now uses different hotspot definitions without changing src.

Example — circle and polygon areas

Not every hotspot is a rectangle. Use circle and poly for other shapes:

shapes.html
<map name="shape-map">
  <area shape="circle" coords="80,80,50" href="/circle" alt="Circle zone">
  <area shape="poly" coords="200,30,260,130,140,130" href="/triangle" alt="Triangle zone">
</map>

How It Works

Circle coords are center X, center Y, radius. Polygon coords are comma-separated x,y pairs for each vertex. Always match coords to the image’s natural dimensions.

♿ Accessibility

  • alt on every <area> — Describes each hotspot for screen readers (required for meaningful maps).
  • Descriptive alt on the image — Summarize the whole graphic, not just “image map.”
  • Provide a text alternative — List links below the image for keyboard-only users when hotspots are hard to discover.
  • Keyboard focus — Image map areas are focusable in many browsers; ensure visible focus styles.
  • Consider SVG for complex UIs — Scalable vector maps with semantic links can be easier to maintain accessibly.

🧠 How usemap Works

1

Define map + areas

Hotspots in HTML.

map
2

Link with usemap

#mapName on img.

usemap
3

User clicks region

Browser tests coords.

Hit test
=

Navigate to href

Multi-link image.

Browser Support

Client-side image maps with usemap are supported in all modern browsers and have been a standard HTML feature for many years. Test coordinate accuracy when images are scaled with CSS.

Universal · Fully supported

Excellent cross-browser support

Image maps work in Chrome, Firefox, Safari, and Edge. Watch for responsive scaling issues with fixed pixel coordinates.

100% Modern browsers
Google Chrome Supported
Supported
Mozilla Firefox Supported
Supported
Apple Safari Supported
Supported
Microsoft Edge Supported
Supported
usemap attribute Excellent

Bottom line: Safe to use; recalculate coords if the displayed image size differs from its natural size.

💡 Best Practices

✅ Do

  • Match usemap="#name" to map name="name"
  • Add meaningful alt on every <area>
  • Use correct coords (left < right, top < bottom for rect)
  • Test hotspots after CSS scaling
  • Offer a plain list of links as backup navigation

❌ Don’t

  • Omit the # prefix in the usemap value
  • Leave areas without alt text
  • Assume coords auto-update on responsive resize
  • Create overlapping areas without testing click priority
  • Use image maps when a simple nav or SVG would be clearer
  • Ensure the referenced <map> contains <area> elements with correct coordinates and destination links.
  • Test image maps thoroughly on different browsers for consistent behavior.
  • Consider accessibility by providing alternative text for each clickable area.

🎉 Conclusion

The usemap attribute is a valuable tool for creating interactive image maps, allowing you to define multiple clickable areas within a single image. Used with <map> and <area>, it enhances navigability for diagrams and visual layouts.

Understanding static markup and dynamic updates with JavaScript helps you build engaging pages while keeping hotspots accessible and well labeled.

Key Takeaways

Knowledge Unlocked

4 truths every developer should know about usemap

Bookmark these before your next usemap implementation.

4
Core concepts
📝 02

Hotspots are <area> elements

Hotspots are <area> elements with shape, coords, and href.

Syntax
⚙️ 03

Coordinates are pixel-based on

Coordinates are pixel-based on the image’s natural size.

Usage
🔒 04

Change maps at runtime

Change maps at runtime with image.useMap = "#otherMap".

Dynamic

❓ Frequently Asked Questions

Use the name attribute on <map>. The usemap value is # plus that name (e.g. usemap="#worldMap" with name="worldMap").
Four numbers: left,top,right,bottom in pixels, where left < right and top < bottom.
Yes. Tap targets use the same coordinate hit-testing. Ensure areas are large enough for touch.
Only if the images share the same dimensions and layout. Usually each image has its own map with matching coords.
It remains valid and widely supported. For responsive or complex graphics, inline SVG links are often easier to maintain.

Build your first image map

Try three clickable zones, then switch maps with JavaScript.

Try the zone example →

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.

5 people found this page helpful