Vanilla Breeze v0.7.4

Vanilla Breeze v0.7.4 released

0.7.4 gives the Ambient pack weather. A page names one feed URL on its own site, and the pack sets data-weather from it, uses its sunrise and sunset for dawn and dusk, and never shows a stale observation. Helpers for producing the feed from Open-Meteo are included. Ambient p…

Read the release notes

area

Defines a clickable region within a map element using pixel-based shape coordinates. Used with img and map for client-side image maps.

Description

The <area> element defines a single clickable region inside an image map. It is always a child of a <map> element. Each area specifies a shape, pixel-based coords, and a destination href.

The <area> element is a void element — it has no closing tag and cannot contain child content. Tooltip text is limited to the title attribute (plain text only).

Live Demo

Hover over a room to see its title tooltip. Click to see the area name. The image is kept at its 800×500 pixel size (the demo scrolls sideways if the window is narrower) so the pixel-based coordinates line up with the drawing.

Shape Types

The shape attribute determines how coords are interpreted. All coordinate values are CSS pixels measured from the top-left corner of the rendered image. They do not scale: if the image is drawn at a different size from the one the coordinates were written for, the regions stay put and stop matching the picture.

Overlapping areas

Areas are hit-tested in document order. Where two areas overlap, the first one in the <map> wins. Put smaller, more specific regions before larger ones, and always put shape="default" last — placed first, it would capture every click.

Rectangle

Defined by the top-left and bottom-right corners: left, top, right, bottom.

Circle

Defined by a centre point and radius: center-x, center-y, radius.

Polygon

Defined by a series of x,y coordinate pairs. Minimum three points. The polygon closes automatically.

Default

Covers the whole image. Because earlier areas win, it only receives clicks that no other area claims — so it must be the last <area> in the map. Useful as a catch-all link.

ShapeCoords formatExample
rectleft, top, right, bottom40,40,320,220
circlecx, cy, radius500,160,80
polyx1,y1, x2,y2, ...480,280,760,280,...
default(none)—

Attributes

AttributeTypeRequiredDescription
shape string No rect, circle, poly, or default. Defaults to rect when omitted.
coords string Yes* Comma-separated pixel coordinates. Not needed for shape="default".
href URL No Navigation target. Without href, the area is not interactive.
alt string Yes** Accessible text label. Required when href is present.
target string No Link target: _self, _blank, _parent, _top
download string No Triggers a download instead of navigation. Value suggests the filename. Only honoured for same-origin URLs (and blob:/data:); cross-origin links navigate normally.
rel string No Link relationship (noopener, noreferrer, etc.)
ping string No Space-separated URLs that receive a POST notification when the area is followed.
referrerpolicy string No How much referrer information to send when following the area (no-referrer, origin, strict-origin-when-cross-origin, etc.)
title string No Tooltip text shown on hover. Plain text only.

The Responsive Problem

The <area> coordinate system uses fixed CSS pixel values measured from the top-left of the rendered image. When the image scales responsively (as it does in every modern layout), the clickable regions no longer align with the visual regions.

For example, an area defined at coords="40,40,320,220" targets pixels 40–320 horizontally. If the image renders at half width (400px instead of 800px), the area still covers pixels 40–320 of the rendered image — now most of its width — so clicks land on the wrong room.

Accessibility

  • Every <area> with an href must have an alt attribute
  • Screen readers announce alt text as the link label
  • Users navigate between areas with Tab
  • Browsers draw the focus ring around the area’s shape. VB styles it with :focus-visible in the theme’s interactive colour; on a busy image it can still be hard to see, so keep hotspots on calm regions or add visible labels.
  • The title attribute provides hover tooltips but is not reliably announced by screen readers — do not use it as the sole accessible name

Related

  • <map> — container element that groups <area> elements
  • <img> — the image element linked via usemap
  • <a> — standard hyperlink (simpler alternative for single-link images)
  • <image-map> — modern responsive replacement with percentage coordinates and rich tooltips
↑