Encodera

Thanks for reading!

Donate to the site — we work hard for you.

HTML & CSS reference

<map>, <area>

An image map: different areas of a picture lead to different addresses.

Syntax

<map name="m"><area shape="rect" coords="…" href="…" alt="…"></map>

Attributes

ParameterTypeDescription
nametextThe map name; the image refers to it with `usemap="#name"`.
shaperect | circle | polyThe shape of an `<area>`.
coordsnumbersThe area coordinates in image pixels.
href, altURL, textWhere the area leads and its description.

Examples

Two clickable areas on a photo:

<img src="/media/photo-400x250.jpg" alt="Coffee shop" width="400" height="250" usemap="#shop">
 
<map name="shop">
  <area shape="rect" coords="0,0,200,250" href="#left" alt="Left half">
  <area shape="circle" coords="300,125,60" href="#right" alt="Circle on the right">
</map>

Notes

Coordinates are in pixels of the original size and do not scale with a fluid image — that is why responsive sites rarely use image maps and instead place links over the picture with CSS or SVG.

See also

  • <img> — An image.
  • <a> — A link to another page, a file or a place on the page.

In the tutorial

  • Images — The img tag, the src and alt attributes, sizes, captions with figure and figcaption, image formats and lazy loading.

Thanks for reading!

Donate to the site — we work hard for you.