Interactive Image Areas

HTML Image Maps

Create interactive images with clickable areas using HTML image maps. Perfect for navigation, floor plans, infographics, and interactive diagrams.

What is an image map in HTML?

An image map makes different regions of one image link to different places. You define clickable <area> shapes (rect, circle, poly) with pixel coordinates inside a <map>, and connect it to the image with usemap="#name". Each area needs alt text. Image maps don't scale responsively without JavaScript, so SVG with links is often the better modern choice.

<img src="floorplan.png" alt="Office floor plan" usemap="#office" width="600" height="400">
<map name="office">
  <area shape="rect" coords="0,0,200,150" href="/rooms/kitchen" alt="Kitchen">
  <area shape="circle" coords="400,200,60" href="/rooms/lounge" alt="Lounge">
</map>

Interactive Image Areas

HTML image maps allow you to define clickable areas within an image, creating interactive experiences for navigation, product showcases, floor plans, and educational content.

Multiple Shapes

Rectangle, circle, and polygon areas

Rich Linking

Links, JavaScript actions, and tooltips

User Friendly

Accessible and responsive design

Image Maps Implementation

Comprehensive examples of HTML image maps including basic shapes, interactive products, floor plans, and responsive implementations.

Code Editor

<img src="https://picsum.photos/id/1040/400/200" alt="Castle and lake" usemap="#places" width="400" height="200">
<map name="places">
  <area shape="rect" coords="0,0,200,200" href="#left" alt="Castle side" onclick="show('Castle side'); return false;">
  <area shape="rect" coords="200,0,400,200" href="#right" alt="Lake side" onclick="show('Lake side'); return false;">
</map>
<p id="out">Click the left or right half of the image.</p>

Preview

Best Practices

Accessibility

  • • Always include alt text
  • • Add descriptive titles
  • • Ensure keyboard navigation
  • • Use ARIA labels

Performance

  • • Optimize image dimensions
  • • Use efficient coordinate systems
  • • Minimize area overlaps
  • • Consider mobile responsiveness

Image Map Checklist

  • Define meaningful alt text
  • Use accurate coordinates
  • Test all clickable areas
  • Ensure mobile compatibility
  • Add hover feedback
  • Validate HTML markup

HTML Image Maps — step by step

1 / 4
1

Create an image map with usemap

Add usemap='#mapname' to an img element, then create a corresponding map element with name='mapname'. Inside the map, define area elements for each clickable region. The map name links the image to its clickable regions.

1 of 4
⚠️Image Maps Are Not Responsive by Default
HTML image map coordinates are fixed pixel values tied to the original image dimensions. When images resize responsively, the clickable areas do not scale with them. For modern responsive designs, consider CSS-positioned overlays or SVG with clickable regions as more flexible alternatives.

🎯 Quick Check

Which attribute links an img element to its map element?

Image Maps Mastered!

Excellent! You've mastered HTML image maps for creating interactive images. Ready to explore Lazy Loading techniques for performance optimization?

HTML Image Maps: summary

Key points

  • Coordinates are in the image's original pixels and don't adjust when CSS resizes it.
  • Inline SVG with <a> elements around shapes is responsive and easier to style.

Frequently asked questions

›Are image maps still used?

Rarely. They still work, but responsive SVG or positioned links over an image are usually better today.