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…
Defines an image map with clickable regions linked to an img element via the usemap attribute. Coordinates are pixel-based and do not scale responsively.
Description
The <map> element defines a client-side image map — a set of clickable regions overlaid on an image. Each region is defined by an <area> child element with pixel-based coordinates. The map is linked to an <img> via the usemapattribute.
Image maps were designed for fixed-size images in the early web. The coordinate system uses absolute pixel values, which means hotspot regions break when the image scales to a different size — a serious limitation in responsive layouts.
Basic Example
Hover over a room to see its title tooltip. Click to see the area name in the status bar. This demo renders the image at its native 800×500 pixels so the pixel-based coordinates align correctly.
The <map> and <img> are connected through two attributes:
The <map> element has a nameattribute (e.g. name="office")
The <img> has a usemapattribute with a hash reference (e.g. usemap="#office")
The browser renders the image normally. When the user clicks or taps within a region defined by an <area>, the browser navigates to that area’s href.
Linking img to map via usemap
1234567891011
<!-- The img references the map by name --><imgsrc="diagram.png"alt="Network diagram"usemap="#network"width="600"height="400" /><!-- The map is identified by its name attribute --><mapname="network"><areashape="rect"coords="10,10,200,150"href="#router"alt="Main router" /><areashape="rect"coords="250,10,450,150"href="#switch"alt="Core switch" /></map>
Native <map> coordinates are defined in absolute pixels matching the image’s natural dimensions. Modern layouts scale images fluidly, but the coordinate system does not scale with them. The result: hotspot regions drift away from their visual targets as the image shrinks or grows.
In a VB page this happens with no author CSS at all. The reset gives every <img>max-inline-size: 100%, so as soon as the container is narrower than the image, the image shrinks and the hotspots stay where they were.
Pixel coordinates break at different sizes
1234567891011
<!-- Native map: pixel coords break at any size other than 800x500 --><imgsrc="plan.jpg"alt="Floor plan"usemap="#plan"width="800"height="500" /><mapname="plan"><!-- These coords target exact pixels in the 800x500 image. When the image scales to 400px wide, coords still reference the original 800px space — hotspots shift off-target. --><areashape="rect"coords="40,40,320,220"href="#room-a"alt="Room A" /></map>
To keep a native map accurate, stop the image from shrinking and let it scroll instead. This is what the demo above does:
Other workarounds (JavaScript that recalculates coordinates on resize) add complexity and fragility. The native element was not designed for responsive use.
Modern Alternative
Vanilla Breeze provides <image-map> as a modern replacement for native <map>/<area>:
<!-- Modern replacement: percentage-based coordinates --><image-map><imgsrc="plan.jpg"alt="Floor plan" /><map-areashape="rect"coords="5 8 40 44"label="Room A"href="#room-a"><strong>Room A</strong><p>Rich HTML tooltip content.</p></map-area></image-map>
Accessibility
Every <area> must have an altattribute describing the linked region
The <img> itself needs an alt describing the overall image
Native image maps support keyboard navigation via Tab between areas
Screen readers announce area alt text as link text
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.
Browser Support
The <map> element has universal browser support dating back to the earliest HTML specifications. However, it was designed for an era of fixed-width layouts and offers no adaptation for modern responsive design.
Related
<area> — defines clickable regions within an image map
<img> — the image element that references a map via usemap
<image-map> — modern responsive replacement with percentage coordinates