CKTIS / HTML
HTML element: area
The void area element defines a clickable image-map region through its geometry, destination, and text alternative.
Version: WHATWG HTML Living Standard; index snapshot date recorded separately
Syntax
<map name="plan"><area href="details" alt="Details" shape="rect" coords="0,0,40,30"></map>area has meaning only inside a map with a name identifier that an img references through usemap.
When href is present, required alt names the region’s destination; without href, alt must be absent because the area is not a hyperlink.
shape accepts default, rect, circle, or poly; coords must fit the shape and is forbidden for default.
The example reads the areas collection, tests :any-link, and observes empty childNodes on a rectangular region.
Examples
<!doctype html>
<meta charset="utf-8">
<base href="https://example.test/maps/">
<map id="plan" name="plan">
<area id="room" href="room-1" alt="Room 1" shape="rect" coords="0,0,40,30">
<area id="rest" href="overview" alt="Other rooms" shape="default">
</map>
<img id="floor" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==" width="80" height="60" alt="Floor plan" usemap="#plan">
<output id="result"></output>
<script>
const plan = document.querySelector("#plan");
const room = document.querySelector("#room");
document.querySelector("#result").textContent = `areas=${plan.areas.length}; href=${room.href}; shape=${room.shape}; coords=${room.coords}; linked=${room.matches(":any-link")}; children=${room.childNodes.length}`;
</script>
Result
areas=2; href=https://example.test/maps/room-1; shape=rect; coords=0,0,40,30; linked=true; children=0
The result verifies the DOM model and resolved URL; it does not perform pixel hit-testing on the image.