<area>
A clickable region of an image map: a rectangle, circle, or polygon with its own address.
- Display
- invisible (acts as an image region)
- Closing tag
- None, void element
- Permitted content
- None, empty element
Example
#<img
src="/collections/covers/python-czy-javascript.webp"
alt="Two desks: on the left a monitor with charts, on the right a laptop with a web page design"
width="360"
height="240"
usemap="#devices"
>
<map name="devices">
<area shape="rect" coords="52,72,152,128" href="/en/docs/python" alt="Monitor with charts: Python documentation">
<area shape="rect" coords="210,80,300,144" href="/en/docs/javascript" alt="Laptop with a web page design: JavaScript documentation">
</map>The regions are invisible. Hover over the monitor or the laptop, or move through them with the Tab key.
Definition and usage
#The <area> element defines one clickable part of an image inside a <map>. It works like an <a> link: it has an href attribute, can open the address in a new tab (target), or download a file (download). It is an empty element.
You choose the shape with the shape attribute, and give the position in coords as numbers in pixels measured from the top left corner of the image. A rectangle is described by two corners, a circle by its center and radius, and a polygon by consecutive vertices.
A region with href must have alt, because it is the only name a screen reader can read. The region itself is invisible: it is revealed only by the cursor change or the focus outline when you reach it with the Tab key.
Syntax
#<area shape="rect" coords="x1,y1,x2,y2" href="…" alt="…">Attributes
#rect | circle | poly | default
The shape of the region:rectis a rectangle (the default),circlea circle,polyany polygon, anddefaultthe whole image apart from the other regions. The example shows a circle on the poster and a polygon outlining the laptop.coords
comma-separated list of numbers
Coordinates in pixels. Forrectthese are the top left and bottom right corners (x1,y1,x2,y2), forcirclethe center and radius (x,y,r), and forpolyconsecutive vertices (x1,y1,x2,y2,…).href
URL
The address the region leads to. Withouthrefthe region is not a link.alt
text
The alternative text of the region, required when the region hashref. It should say where the click leads.target / download / rel
as in the `<a>` element
They work the same as in a link:target="_blank"opens the address in a new tab,downloaddownloads the file instead of opening it, andreldescribes the relationship with the target.
The element also supports all global attributes, such as class, id, style and hidden.
Attributes in practice
#shape
rect | circle | poly | defaultThe shape of the region: rect is a rectangle (the default), circle a circle, poly any polygon, and default the whole image apart from the other regions. The example shows a circle on the poster and a polygon outlining the laptop.
<img
src="/collections/covers/python-czy-javascript.webp"
alt="Two desks: on the left a monitor with charts, on the right a laptop with a web page design"
width="360"
height="240"
usemap="#shapes"
>
<map name="shapes">
<area shape="circle" coords="250,36,12" href="/en/collections" alt="Poster on the wall: article collections">
<area shape="poly" coords="214,83,287,83,287,128,296,140,212,140" href="/en/docs/html" alt="Laptop: HTML documentation">
</map>Hover over the round shape on the poster or over the laptop.
Browser support
#Widely available
Works in all modern browsers, phones included. You can use it without worry.
- Chrome
- Edge
- Firefox
- Safari
Good practices
#<area>works only inside a<map>, and the image must point to the map with theusemapattribute.- The coordinates refer to the image at the size displayed on the page, not the original file. If you change the image’s
width, recalculatecoordstoo.
Related entries
#Spotted a mistake or missing an example? Write to us.