By the end of this tutorial, you’ll confidently build clickable image maps with semantic HTML in real-world projects.
01
map + area Workflow
Connect <img usemap>, <map>, and <area> hotspots.
02
Shape Types
Define regions with rect, circle, poly, and default.
03
Link Attributes
Use href, target, rel, and alt on hotspots.
04
Coordinates
Find and set accurate pixel coords for each shape type.
05
Accessibility
Provide alt labels and text-link alternatives for every region.
06
Modern Alternatives
Know when to use SVG instead of raster image maps.
Fundamentals
What Is the <area> Tag?
The area element (<area>) is used with the <map> element to define clickable regions (hotspots) within an image. When a user clicks a hotspot, the browser navigates to the linked URL or runs a script.
💡
Void element inside <map>
The <area> tag has no closing tag and no content—all configuration is done through attributes. Link the map to an image with usemap="#map-name" on the <img> element.
Each <area> defines one hotspot. The parent <map> container holds all areas, and the image’s usemap attribute must match the map’s name (prefixed with #).
Structure
The <map> Element
The <map> element is the container for all hotspots. It has a name attribute that must match the usemap value on the image (prefixed with #). Each child <area> defines one clickable region.
img
usemap="#name"
Associates the raster image with the map.
map
name="name"
Container holding one or more area elements.
area
shape + coords
One hotspot per element; void tag, no closing tag.
→
Anywhere in body
Map can follow the img; order does not affect behavior.
complete-structure.html
<imgsrc="/images/area-example.png"alt="Site navigation diagram"usemap="#site-map"width="256"height="256"><mapname="site-map"><areashape="rect"coords="253,98,111,1"href="/html/tags/a"alt="HTML anchor tag tutorial"><areashape="rect"coords="253,250,74,148"href="https://codetofun.com/css"alt="CSS tutorials"></map>
Foundation
📝 Syntax
Place <area> elements inside a <map>, then link the map to an image with usemap:
Use shape="circle" for round clickable regions. Coordinates are center-x, center-y, radius in pixels. Ideal for logos, buttons, and circular UI elements on a diagram.
Click the JS logo region. coords="64,64,60" on a 128×128 image.
Polygon-Shaped Hotspot
Use shape="poly" for irregular regions defined by three or more coordinate pairs. Each pair is a vertex of the polygon—perfect for triangular slices, map outlines, or non-rectangular UI zones.
Click inside the triangular hotspot in the upper-left area.
target & rel Attributes
Image map links support the same navigation attributes as <a> tags. Use target="_blank" to open external destinations in a new tab, and always pair it with rel="noopener noreferrer" for security.
target-rel-area.html
<areashape="rect"coords="253,98,111,1"href="https://codetofun.com"target="_blank"rel="noopener noreferrer"alt="Visit CodeToFun — opens in new tab">
Image map coordinates are pixel positions relative to the top-left corner of the image. They must match the width and height on your <img> (e.g. our area-example.png is 256×256).
1
Set Fixed Dimensions
Add width and height on the <img> matching the image’s natural pixel size.
2
Use a Map Editor
Online image-map generators export coords; GIMP and Photoshop show cursor position in pixels.
3
Test in the Browser
Click each hotspot and tweak coords until regions align. Confirm rendered dimensions in DevTools.
HTML image map coordinates are fixed in pixels and do not automatically scale when an image is resized with CSS. This is the biggest limitation of raster image maps.
✅ Strategies That Work
Set matching width/height attributes on <img> and avoid CSS scaling
Use max-width: 100% only when width/height attrs scale proportionally
Recalculate coords with JavaScript on resize events for fluid layouts
Switch to SVG for truly responsive interactive graphics
❌ Common Pitfalls
Stretching an image with CSS while keeping original coords—hotspots drift
Using percentage-based coordinates (not supported in HTML image maps)
Building complex responsive UIs purely with raster image maps
A11y
♿ Accessibility
Image maps must be usable by keyboard and screen reader users. Follow these patterns:
Image alt — Describe the overall graphic on the <img> element
Area alt — Required on every linked <area>; describes what that region links to
Text alternative — Provide a visible list of links below the image for users who cannot use the map
Touch targets — Make hotspots at least 44×44 CSS pixels on mobile
Focus — Linked areas are focusable; ensure visible focus styles if you style the page
accessible-map.html
<imgsrc="/images/area-example.png"alt="Diagram linking to CSS and HTML tutorials"usemap="#topics"width="256"height="256"><mapname="topics"><areashape="rect"coords="253,98,111,1"href="https://codetofun.com/css"alt="CSS tutorials"><areashape="rect"coords="253,250,74,148"href="/html/tags/a"alt="HTML anchor tag tutorial"></map><navaria-label="Topics (text alternative)"><ul><li><ahref="https://codetofun.com/css">CSS tutorials</a></li><li><ahref="/html/tags/a">HTML anchor tag</a></li></ul></nav>
Comparison
⚖️ HTML Image Maps vs SVG
Both technologies create clickable regions on graphics, but they suit different scenarios:
Aspect
HTML <area>
SVG <a> + shapes
Best for
PNG/JPG photos, infographics, product images with a few hotspots
Scalable diagrams, maps, charts; CSS-stylable regions
Site navigation diagrams, educational infographics, product feature callouts with a few hotspots.
❌
Poor Fit
Complex responsive UIs, frequently updated layouts, mobile-first designs with many regions.
CSS
CSS Overlay
Positioned <a> elements over an image with absolute positioning as an alternative.
SVG
Modern Choice
Scalable, accessible, styleable interactive vector graphics for complex diagrams.
🧠 How Image Maps Work
1
Define the map
Create a <map name="..."> with one or more <area> children specifying shapes and coords.
Markup
2
Link the image
Add usemap="#map-name" on the <img> to associate it with the map.
Association
3
User clicks a region
The browser detects which <area> coords contain the click and follows the href or runs the handler.
Interaction
=
🗺
One image, many destinations
A single graphic becomes a navigation hub—ideal for diagrams, infographics, and visual site maps.
Compatibility
Universal Browser Support
The <area> tag is supported in every major browser without polyfills.
✓ Baseline · Since HTML 3.2
Works everywhere your users are
From legacy Internet Explorer to the latest Chromium builds — image maps and the <area> element are universally supported.
100%Core tag support
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
<area> tag100% supported
Bottom line: Ship image maps with confidence. The <area> element is safe to use in every production environment today.
Wrap Up
Conclusion
The <area> tag turns static images into interactive navigation hubs. Combine <map>, <area>, and usemap with descriptive alt text, fixed image dimensions, and text-link alternatives.
For responsive or complex interactive graphics, reach for SVG—but for raster diagrams and infographics, HTML image maps remain a simple, universally supported solution.
Always provide alt text on every <area> with an href
Set explicit width and height on the image to keep coords accurate
Use target="_blank" with rel="noopener noreferrer" for external links
Test image maps on touch devices—hotspots must be at least 44×44px
Use an image map editor to get accurate coords values
Keep the <map name> and <img usemap> values in sync
Provide a text-based navigation alternative alongside image maps
❌ Don’t
Omit alt on linked areas—screen readers need region labels
Create tiny hotspots that are hard to click on mobile
Scale images with CSS while keeping fixed pixel coords unchanged
Rely on image maps as the only navigation method
Use image maps for complex responsive layouts—prefer SVG instead
Nest <area> outside a <map> element
Summary
Key Takeaways
Knowledge Unlocked
Six truths every developer should know about <area>
Bookmark these before you ship — they’ll make every image map clearer and more accessible.
6
Core concepts
🗺01
One Hotspot Per Element
<area> defines one clickable region. Must be inside <map>; image uses usemap="#name".
Foundation
📐02
shape + coords
rect, circle, poly, and default define region geometry in pixel coordinates.
Geometry
🔗03
href + alt
href sets the link destination; alt is required for accessibility when href is present.
Links
🔒04
target + rel
Use target="_blank" with rel="noopener noreferrer" for external new-tab links.
Security
📱05
Fixed Pixel Coords
Coords don’t scale with CSS. Use SVG or JavaScript for responsive interactive graphics.
Responsive
🌐06
Universal Support
Supported in every browser including IE. Always provide a text link list as an accessible alternative.
Compatibility
❓ Frequently Asked Questions
The <area> element defines clickable hotspots within an image map, used with <map> and <img usemap>.
<map> is the container; each <area> inside it defines one clickable region on the linked image.
shape sets the hotspot geometry: rect (rectangle), circle, poly (polygon), or default (remaining image area).
Yes, when href is present. The alt attribute describes the region for screen readers and when images fail to load.
Use online image map generators, graphics software, or browser DevTools. Rectangles need top-left and bottom-right pixel pairs; circles need center x, y, and radius; polygons need at least three vertex pairs.
Coordinates are pixel-based and tied to the image’s dimensions. If CSS scales the image, hotspots may misalign. Keep fixed width/height attributes, recalculate with JavaScript, or use SVG for fluid layouts.
Yes. Add target="_blank" and rel="noopener noreferrer" on the <area> element, just like on <a> tags.
Use HTML image maps for raster images (PNG, JPG) with a few hotspots. Choose SVG when you need scalable vector graphics, many interactive regions, or responsive behavior without JavaScript.
shape="default" covers the entire image minus regions defined by other <area> elements. Use it as a catch-all hotspot for unmapped parts of the graphic.