HTML <map> Tag

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

Definition and Usage

The <map> element defines an image map — named clickable regions used with <area> and an <img> that points to the map with usemap.

Give the map a required name (no spaces, unique in the document). On the image, set usemap="#that-name". Each hotspot needs shape, coords, href, and a clear alt.

Baseline · Widely available.

Not deprecated. Stable across modern browsers since about July 2015.

Responsive pitfall.

Area coordinates are tied to the image’s intrinsic size. CSS scaling often misaligns hotspots — keep displayed size equal to the coord system, or use another pattern for fluid layouts.

HTML Syntax

syntax.html
<img src="photo.jpg" alt="Description" usemap="#plan" width="300" height="150">
<map name="plan">
  <area shape="rect" coords="0,0,150,150" href="/left" alt="Left region">
</map>

Both start and end tags are required on map. The # in usemap is required.

Attributes

The attributes you will use for image maps:

AttributeDescriptionTry it
nameRequired — unique map name (no spaces); referenced by usemap="#name"Try it
usemap (on img)Links the image to the map; value is # + the map nameTry it
shape / coords (on area)Hotspot geometry: rect, circle, or polyTry it
alt (on area)Accessible name for each link regionTry it
id (optional)If present on map, must equal nameSame as name

Global Attributes

The <map> tag also supports the Global Attributes in HTML.

Live Preview

Switch hotspot shapes and see the matching map / area markup. Click the demo image to follow a region.

Demo image is 128×128. Keep width/height in sync with coords.

Image map
JavaScript logo demo mapFull logo — Learn JavaScript

One rect covering the whole 128×128 image.

HTML Examples

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

Example 1 — Basic Image Map

Connect img to map with matching usemap / name.

HTML
<img
  src="/images/javascript.png"
  alt="JavaScript logo"
  usemap="#js-map"
  width="128"
  height="128"
>
<map name="js-map">
  <area
    shape="rect"
    coords="0,0,128,128"
    href="/js/interview"
    alt="Learn JavaScript"
  >
</map>
Try It Yourself

How It Works

  1. Set usemap="#js-map" on the image (include #).
  2. Create <map name="js-map"> with the same name (no #).
  3. Add an <area> with shape, coords, href, and alt.
  4. Match width/height to the coordinate system you wrote.

Example 2 — Circle Hotspot

Use shape="circle" with coords="x,y,radius".

HTML
<img
  src="/images/javascript.png"
  alt="JavaScript logo"
  usemap="#circle-map"
  width="128"
  height="128"
>
<map name="circle-map">
  <area
    shape="circle"
    coords="64,64,60"
    href="/js/interview"
    alt="Circular hotspot — Learn JavaScript"
  >
</map>
Try It Yourself

How It Works

  1. Choose shape="circle" for a round region.
  2. Write coords="cx,cy,r" — center x, center y, radius.
  3. Keep the map name unique and matching usemap.
  4. Provide alt that describes where the click goes.

Example 3 — Two Regions on One Map

One map can hold several area elements.

HTML
<img
  src="/images/area-example.png"
  alt="Two clickable regions"
  usemap="#split-map"
  width="256"
  height="256"
>
<map name="split-map">
  <area
    shape="rect"
    coords="0,0,256,128"
    href="/html/tags/a"
    alt="Top half — HTML a tag"
  >
  <area
    shape="rect"
    coords="0,128,256,256"
    href="/html/tags/img"
    alt="Bottom half — HTML img tag"
  >
</map>
Try It Yourself

How It Works

  1. Define one map with a single unique name.
  2. Add one area per hotspot with its own coords and href.
  3. Give every area an alt that names that destination.
  4. Order matters for overlaps — earlier areas typically win when regions overlap.

Edge Cases & Pitfalls

Most map bugs are name mismatches, missing #, bad coords, or responsive scaling.

name

usemap must include #

Write usemap="#plan" and name="plan". Omitting # breaks the link.

unique

Duplicate map names

name must be unique and non-empty, with no space characters. If you set id, it must equal name.

responsive

CSS-scaled images break hit areas

Coords do not auto-scale with width: 100%. Prefer fixed size or overlay links / SVG for fluid UIs.

a11y

Missing alt on areas

Each linked region needs an accessible name. Also keep a meaningful alt on the img.

coords

Wrong coordinate units

rect is x1,y1,x2,y2; circle is cx,cy,r; poly is a list of x,y pairs.

Browser Support

The <map> element is core HTML in every browser. It is not a Node.js, Deno, or Bun API.

✓ Baseline · Widely available

<map>

Widely available since about July 2015. Pair with area and img usemap everywhere.

98% Global support (approx.)
Google Chrome All
Full support
Mozilla Firefox All
Full support
Apple Safari All
Full support
Microsoft Edge All
Full support
Opera All
Full support
Samsung Internet All
Full support
Internet Explorer All
Supported
<map> Widely supported

Bottom line: Safe for classic image maps. Watch coordinate alignment when images resize.

Key Takeaways

  • Trio: img[usemap] + map[name] + area hotspots.
  • name: required, unique, no spaces; usemap="#name".
  • Areas: set shape, coords, href, and alt.
  • Scaling: avoid CSS-only resize that desyncs hit areas.

One line: usemap="#name" + <map name="name"> + labeled <area>s.

Default CSS Settings

<map> itself does not draw a box; hotspots are hit-testing regions on the image:

default.css
map {
  display: inline; /* typical — no visible chrome of its own */
}

/* The linked image still uses normal replaced-element rules */
img {
  /* display / sizing from the UA and your layout */
}

Style the img for layout; do not expect borders or backgrounds on map to outline the areas.

Frequently Asked Questions

The map element defines an image map — a set of clickable regions — used together with area elements and an img that references the map via usemap.
On the img, set usemap="#name" where name matches the map’s name attribute (include the #). The name must be unique in the document and contain no spaces.
One or more area elements that set shape, coords, href, and alt for each hotspot.
If you set both name and id on the same map, they must have the same value.
Hotspot coordinates are based on the image’s intrinsic size. Scaling the image with CSS often misaligns areas — prefer fixed display size or another UI pattern for fluid layouts.
Yes. Each area that is a link needs an alt that describes the destination or purpose, similar to a text link.

Next: mark

Highlight text for reference with the HTML mark element.

mark 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.

10 people found this page helpful