CKTIS / HTML
prvek HTML: area
Prázdný prvek oblasti definuje klikací region obrazové mapy geometrií, cílem a textovou alternativou.
Verze: WHATWG HTML Living Standard; index snapshot date recorded separately
Syntaxe
<map name="plan"><area href="details" alt="Details" shape="rect" coords="0,0,40,30"></map>area má význam jen v map s identifikátorem name, na který img odkazuje přes usemap.
S přítomným href povinné alt pojmenuje cíl; bez href musí alt chybět, protože oblast není odkazem.
shape přijímá default, rect, circle či poly; coords musí odpovídat tvaru a pro default je zakázáno.
Příklad čte kolekci areas, zkouší :any-link a sleduje prázdné childNodes obdélníkové oblasti.
Příklady
<!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>
Výsledek
areas=2; href=https://example.test/maps/room-1; shape=rect; coords=0,0,40,30; linked=true; children=0
Výsledek potvrzuje model DOM a vyřešenou URL; neprovádí test zásahu pixelu obrázku.