HTML <area> Tag

Beginner
⏱️ 9 min read
📚 Updated: Jun 2026
🎯 7 Examples
Image Maps

What You’ll Learn

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.

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 #).

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
<img src="/images/area-example.png" alt="Site navigation diagram" usemap="#site-map" width="256" height="256">

<map name="site-map">
  <area shape="rect" coords="253,98,111,1" href="/html/tags/a" alt="HTML anchor tag tutorial">
  <area shape="rect" coords="253,250,74,148" href="https://codetofun.com/css" alt="CSS tutorials">
</map>

📝 Syntax

Place <area> elements inside a <map>, then link the map to an image with usemap:

syntax.html
<img src="your-image.jpg" alt="Your Image" usemap="#image-map">

<map name="image-map">
  <area shape="rect" coords="0,0,50,50" href="page1.html" alt="Area 1">
  <area shape="circle" coords="100,100,50" href="page2.html" alt="Area 2">
</map>
  • The usemap value must match the map element’s name, prefixed with #.
  • Each <area> is a void element—no closing tag and no inner content.
  • Omit href for non-navigating hotspots, or use onclick for custom behavior.

⚡ Quick Reference

AttributeValuesPurpose
shaperect · circle · poly · defaultGeometry of the hotspot region
coordsPixel valuesCoordinate pairs matching the chosen shape
hrefURLDestination when the hotspot is clicked
altTextAccessible label (required when href is set)
target_blank, _self, etc.Where to open the linked page
relnoopener noreferrerLink relationship; use with target="_blank"
hreflangLanguage codeLanguage of the linked document
referrerpolicyno-referrer, etc.Controls Referer header on navigation

📐 Shape & Coordinates

The coords attribute format depends on shape:

Shapecoords FormatDescription
rectx1,y1,x2,y2Top-left corner, then bottom-right corner
circlex,y,rCenter x, center y, then radius in pixels
polyx1,y1,x2,y2,...Pairs of x,y points defining a polygon (3+ vertices)
defaultNo coords neededCovers the whole image minus other defined areas

🧰 Attributes

The <area> tag supports attributes to specify the shape, coordinates, and behavior of each hotspot:

shape Geometry

Region geometry: rect, circle, poly, or default. Defaults to rect if omitted.

shape="circle"
coords Required

Pixel coordinates matching the chosen shape. Must align with the image’s width and height.

coords="64,64,60"
href Navigation

URL to navigate to when the hotspot is clicked. Omit for non-navigating regions.

href="/html/tags/a"
alt Required*

Accessible label for the region. Required when href is set so screen readers can describe each hotspot.

alt="CSS tutorials"
target / rel Links

Same as <a> tags. Use target="_blank" with rel="noopener noreferrer".

target="_blank" rel="noopener noreferrer"
download / hreflang Optional

Prompt download for same-origin files, or hint the language of the destination document.

hreflang="en"

* alt is required when href is present. The obsolete HTML4 nohref attribute is no longer needed—simply omit href instead.

Examples Gallery

Seven real-world image map patterns with copy-ready code, live previews, and hands-on practice. Click the regions in each output to test hotspots.

👀 Live Preview — Click the Regions

This image map has two rectangular hotspots. Click the HTML or CSS labeled region:

HTML and CSS navigation map — click a labeled regionLearn CSSLearn HTML
CSS

shape="rect"

coords="253,98,111,1" — top-left to bottom-right

HTML

shape="rect"

coords="253,250,74,148" — second hotspot

Basic Image Map

A single rectangular <area> inside a <map>, linked to an image via usemap.

attributes.html
<area shape="rect" coords="126,0,3,126" href="/js/interview" alt="Learn JavaScript">
Try It Yourself

📚 Common Use Cases

Developers use <area> to create interactive image maps for navigation, diagrams, and product showcases.

Image Navigation

Create interactive image maps for navigation, providing users with clickable regions that link to different sections or pages.

image-navigation.html
<img src="/images/area-example.png" alt="HTML and CSS navigation map" usemap="#image-map" width="256" height="256">
<map name="image-map">
  <area shape="rect" coords="253,98,111,1" href="https://codetofun.com/css" target="_blank" rel="noopener noreferrer" alt="Learn CSS">
  <area shape="rect" coords="253,250,74,148" href="/html/tags/a" alt="Learn HTML">
</map>
Try It Yourself

Interactive Image Details

Enhance user experience by letting users click specific parts of an image to view detailed information or pop-ups using JavaScript onclick handlers.

image-details.html
<map name="product-map">
  <area shape="rect" coords="253,98,111,1" alt="Learn CSS" onclick="alert('You clicked Learn CSS!'); return false;">
  <area shape="rect" coords="253,250,74,148" alt="Learn HTML" onclick="alert('You clicked Learn HTML!'); return false;">
</map>
Try It Yourself

Circle-Shaped Hotspot

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.

circle-area.html
<area shape="circle" coords="64,64,60" href="/js/interview" alt="JavaScript — circular hotspot">
Try It Yourself

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.

polygon-area.html
<area shape="poly" coords="50,50,200,50,125,200" href="/html/tags/a" alt="HTML Tags — triangular region">
Try It Yourself

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
<area shape="rect" coords="253,98,111,1" href="https://codetofun.com" target="_blank" rel="noopener noreferrer" alt="Visit CodeToFun — opens in new tab">
Try It Yourself

Complete Page Structure

A production-ready image map combines the <img>, <map>, and multiple <area> elements with explicit width and height so coordinates stay accurate.

full-page-map.html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Site Navigation Map</title>
</head>
<body>
  <h1>Choose a Topic</h1>
  <img src="/images/area-example.png" alt="Site navigation diagram" usemap="#site-map" width="256" height="256">
  <map name="site-map">
    <area shape="rect" coords="253,98,111,1" href="https://codetofun.com/css" alt="CSS tutorials">
    <area shape="rect" coords="253,250,74,148" href="/html/tags/a" alt="HTML anchor tag tutorial">
    <area shape="default" href="/html/tags/area" alt="Image map tutorial">
  </map>
  <nav aria-label="Text alternative">
    <ul>
      <li><a href="https://codetofun.com/css">CSS tutorials</a></li>
      <li><a href="/html/tags/a">HTML anchor tag</a></li>
    </ul>
  </nav>
</body>
</html>
Try It Yourself

📍 Finding Coordinates

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.

Coordinate Format Cheat Sheet

ShapeFormatExample
Rectanglex1,y1,x2,y2 — top-left, then bottom-right253,98,111,1
Circlecx,cy,r — center point, then radius64,64,60
Polygonx1,y1,x2,y2,... — at least 3 vertex pairs50,50,200,50,125,200

See Shape & Coordinates for full attribute details.

📱 Responsive Image Maps

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)
  • Assuming srcset swaps won’t affect hotspot alignment
  • Building complex responsive UIs purely with raster image maps

♿ 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
<img src="/images/area-example.png" alt="Diagram linking to CSS and HTML tutorials" usemap="#topics" width="256" height="256">
<map name="topics">
  <area shape="rect" coords="253,98,111,1" href="https://codetofun.com/css" alt="CSS tutorials">
  <area shape="rect" coords="253,250,74,148" href="/html/tags/a" alt="HTML anchor tag tutorial">
</map>
<nav aria-label="Topics (text alternative)">
  <ul>
    <li><a href="https://codetofun.com/css">CSS tutorials</a></li>
    <li><a href="/html/tags/a">HTML anchor tag</a></li>
  </ul>
</nav>

⚖️ HTML Image Maps vs SVG

Both technologies create clickable regions on graphics, but they suit different scenarios:

AspectHTML <area>SVG <a> + shapes
Best forPNG/JPG photos, infographics, product images with a few hotspotsScalable diagrams, maps, charts; CSS-stylable regions
ResponsivenessFixed pixel coords; may misalign when scaledCoords scale with the graphic natively
Browser supportUniversal in all browsersUniversal in all modern browsers

For vector-based interactive diagrams, see our SVG Links tutorial.

💡 When to Use Image Maps

Good Fit

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.

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 Chrome All versions · Desktop & Mobile
Full support
Mozilla Firefox All versions · Desktop & Mobile
Full support
Apple Safari All versions · macOS & iOS
Full support
Microsoft Edge All versions · Chromium & Legacy
Full support
Internet Explorer IE 6+ · Legacy environments
Full support
Opera All modern versions
Full support
<area> tag 100% supported

Bottom line: Ship image maps with confidence. The <area> element is safe to use in every production environment today.

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.

💡 Best Practices

✅ Do

  • 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

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

Build Your Own Image Map

Open the Try It editor and experiment with clickable image regions.

Try Image Navigation →

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.

12 people found this page helpful