Codectionary / Developer documentation / HTML

<map> and <area>

Image maps let different regions of a single image act as separate clickable links. The <map> element defines the map, referenced from an <img> via its usemap attribute, and each <area> inside it defines one clickable region using coordinates and a shape.

Syntax

<img src="image.jpg" usemap="#map1">
<map name="map1">
  <area shape="rect" coords="0,0,100,100" href="/page1">
</map>

Examples

Rectangular Regions

A simple image map with rectangular clickable areas.

<img src="nav-diagram.png" usemap="#navmap" alt="Site navigation diagram">
<map name="navmap">
  <area shape="rect" coords="0,0,150,50" href="/home" alt="Home">
  <area shape="rect" coords="150,0,300,50" href="/about" alt="About">
</map>

Circular Region

Defining a circular clickable area.

<img src="world-map.png" usemap="#continents" alt="World map">
<map name="continents">
  <area shape="circle" coords="200,150,40" href="/europe" alt="Europe">
</map>

Polygon Region

Defining a custom-shaped clickable area.

<map name="shapes">
  <area shape="poly" coords="50,10,90,90,10,90" href="/triangle-info" alt="Triangle">
</map>

Attributes

  • name (string): Used on map; must match the img's usemap value
  • usemap (string): Used on img; references a map by name, prefixed with #
  • shape (rect | circle | poly | default): Used on area; the shape of the clickable region
  • coords (string): Used on area; coordinates defining the region's boundaries

Best practices

  • Always include alt text on each area for accessibility, same as a regular link
  • Consider whether separate, individually styled elements (like a CSS grid of linked images) would be simpler than coordinate-based regions
  • Image maps do not scale coordinates automatically with responsive images — test carefully on different screen sizes
  • Keep coordinate math simple by using rect and circle shapes where possible rather than complex polygons

At a glance

Purpose
Structure and meaning for web content
File extension
.html · .htm
Runs in
Web browsers
Usually used with
CSS and JavaScript

Specifications & further reading

Related HTML documentation