Blog · Technical

Make an image clickable without an image map

You want several parts of one picture to do different things. There are four ways to get there, only some of them survive a phone, and one of them you should stop reaching for by default.

Free forever plan · No credit card · Works in Wix, Webflow, WordPress, Shopify, Squarespace

Legacy HTML image map with pixel coordinates compared to percentage-based hotspots

CSS overlay anchors

Percentage-positioned links over the image. Responsive, stylable, no library.

Inline SVG

Best when the clickable region is a genuinely irregular shape.

Hotspot embed

When you want cards, media, and to edit copy without touching markup again.

What you get

  • Percentage-positioned anchors are responsive with zero JavaScript
  • display:block on the image prevents a mysterious few-pixel offset
  • SVG with a viewBox is the right tool for irregular regions
  • <map>/<area> is valid but unsuited to responsive layouts
  • Convert old coords by dividing by the image's natural width and height
  • Every clickable region needs a label, focus, and a visible affordance

Option 1: percentage-positioned overlay anchors

This is the default answer for most cases, and it is about fifteen lines. Put the image in a relatively-positioned wrapper and absolutely position real <a> elements over it in percentages.

<div style="position:relative; max-width:1200px">
  <img src="diagram.png" alt="Air handler cutaway" style="display:block; width:100%">

  <a href="/parts/valve"
     aria-label="Mixing valve"
     style="position:absolute; left:50%; top:42%;
            width:12%; height:14%; transform:translate(-50%,-50%)">
  </a>

  <a href="/parts/coil"
     aria-label="Heat exchange coil"
     style="position:absolute; left:71%; top:63%;
            width:10%; height:12%; transform:translate(-50%,-50%)">
  </a>
</div>

Every number is a percentage, so the links scale with the picture automatically. Three details make or break it:

  • display:block on the image removes the inline-element gap that otherwise shifts everything a few pixels down.
  • aria-label on each anchor is not optional — an empty link is invisible to a screen reader.
  • Give the anchors a visible affordance (a dot, a ring, a subtle tint on hover). An invisible clickable region is the original sin of image maps; don't reproduce it.

Careful with object-fit: if the image is letterboxed inside its box, percentages of the box are not percentages of the picture. That failure mode is covered in why hotspots drift on mobile.

Option 2: inline SVG

When the clickable area is a genuinely irregular shape — a country on a map, a seating block, a room outline — SVG is the honest tool. A viewBox gives you a coordinate system that scales with the element, so the responsiveness problem never arises.

<svg viewBox="0 0 1200 600" style="width:100%; height:auto">
  <image href="plan.png" width="1200" height="600" />
  <a href="/rooms/kitchen" aria-label="Kitchen">
    <polygon points="410,120 640,120 640,300 410,300"
             fill="transparent" stroke="none" />
  </a>
</svg>

Costs: the shape coordinates are tedious to author by hand, hit-testing a fill="transparent" shape requires a fill (not none), and any rich content you want on click still has to be built in HTML on top.

Option 3: the legacy <map> / <area> element

Still valid HTML, still supported, and still the wrong default. Its coordinates are absolute pixels measured against the image's natural size, and CSS scaling does not rescale them — so the clickable regions slide off the picture on any responsive layout. It also only produces links: no card, no photo, no description.

It is defensible in exactly one situation: a fixed-width image that will never scale, where you need irregular regions and nothing but links. That situation is rarer every year.

Option 4: a hotspot embed

The other three options all assume you are happy maintaining markup. If what you actually want is for a marketing or ops colleague to change a label next quarter without opening a code editor, an embed is the pragmatic answer: place markers visually, and the site holds one iframe that never needs editing again.

It also gets you the things plain anchors don't have: popup cards with a title, description, photo, video, and CTA; colour-coded categories; numbered markers; and edits that propagate to every page hosting the embed at once. The trade-off is that the content lives inside an iframe, so publish the important information as real text on the page too — see SEO for interactive images.

Choosing between them

NeedBest option
A handful of links, you own the markupCSS overlay anchors
Whole irregular shapes must be clickableInline SVG
Popups with text, photos, video, and CTAsHotspot embed
Non-developers will edit the contentHotspot embed
Fixed-width image, links only, no scaling everLegacy map / area
Dozens of regions on a dense planHotspot embed with categories

Migrating off an existing image map

You don't need to re-derive anything. Every old coordinate is relative to the image's natural width and height, so one division per number converts it:

<!-- before: natural size 1200 x 600 -->
<area shape="rect" coords="360,180,480,300" href="/parts/valve">

<!-- centre of that rect: (420, 240) -->
<!-- 420 / 1200 = 35%   240 / 600 = 40% -->

<!-- after -->
<a href="/parts/valve" aria-label="Mixing valve"
   style="position:absolute; left:35%; top:40%;
          transform:translate(-50%,-50%)"></a>
  • circle — the first two numbers are already the centre.
  • rect — average the x pair and the y pair.
  • poly — take the middle of its bounding box, which is close enough for a marker.

Then move each href to the new link and each alt to its label. In practice, clicking the same points on the image in a visual editor is faster than the arithmetic for anything over about six regions — the image map generator page covers that route step by step.

Accessibility, whichever you pick

  • Give the base image real alt text describing the whole picture, not a list of the regions.
  • Every clickable region needs an accessible name — visible text or aria-label.
  • Anything clickable must be focusable and operable by keyboard. Real <a> and <button> elements give you this free; a clickable div does not.
  • Make the interactive areas visible. Hover-only discovery excludes touch users entirely.
  • Don't hide information that exists only inside the image — publish it as text somewhere on the page.

Frequently asked questions

Is a clickable div with an onclick handler acceptable?

Avoid it. A div is not focusable or operable by keyboard and announces nothing to assistive tech. Use an <a> for navigation and a <button> for in-page actions.

Do overlay anchors hurt SEO?

No — they are ordinary links in the page's HTML, so crawlers follow them normally. Give each one a descriptive aria-label, since an empty anchor gives a crawler no anchor text to work with.

How many clickable regions is too many?

Past roughly 40–50 the image itself becomes the bottleneck rather than the markup: markers crowd each other and visitors stop scanning. Split the image or group regions into colour-coded categories.

Turn any image into a guided experience.

Free forever plan. Paste one iframe into your site and ship.

Create your interactive image