Tag area

🗺️ HTML <area> Tag — Defining Clickable Regions in Image Maps

The <area> tag in HTML is used within an <map> element to define interactive regions on an image. These regions, or “hotspots,” can be shaped differently and are linked to various URLs, allowing the image to act like a clickable map.


📌 What Is the <area> Tag?

  • The <area> tag defines a specific clickable area inside an image when using an image map.
  • It is empty (self-closing) — it doesn’t have content inside.
  • Must be used within a <map> element.
  • Works in conjunction with the usemap attribute on an <img> tag.
  • Supports several shapes: rectangle, circle, polygon.

✅ Basic Syntax

<area shape="rect" coords="34,44,270,350" href="https://example.com" alt="Example Link" />
  • shape: the type of region (rectcirclepoly).
  • coords: the coordinates for the region.
  • href: the link destination.
  • alt: alternative text for accessibility.

🧪 Full Example: Interactive Image Map

<img src="planets.jpg" alt="Planets" usemap="#planetmap" width="600" height="300">

<map name="planetmap">
<area shape="rect" coords="0,0,100,100" href="https://mars.nasa.gov" alt="Mars">
<area shape="circle" coords="300,150,50" href="https://www.nasa.gov" alt="NASA">
<area shape="poly" coords="400,100,450,150,400,200,350,150" href="https://jupiter.com" alt="Jupiter">
</map>

🧭 This will create clickable zones on the image: a rectangle, a circle, and a polygon.


🎨 Supported Attributes of <area>

AttributeDescription
shapeDefines the shape: rectcirclepoly, or default
coordsCoordinates defining the shape
hrefThe link the area points to
altAlternative text (important for accessibility)
targetSpecifies where to open the link (_blank_self, etc.)
downloadSuggests downloading the linked file
relRelationship between document and link
typeMIME type of the target document

📏 Shape and Coordinate Formats

Shapecoords formatDescription
rectx1,y1,x2,y2Top-left and bottom-right corners
circlex,y,radiusCenter and radius
polyx1,y1,x2,y2,x3,y3,...Sequence of polygon points
defaultno coordinates neededCovers the entire image as fallback

🧠 Accessibility Tips

  • Always provide the alt attribute so users using screen readers understand what the area represents.
  • Consider also using a title attribute for hover tooltips.
  • Ensure that the image map makes sense visually and logically.

⚠️ Best Practices

  • Don’t rely on image maps for navigation unless essential; use them for infographics or diagrams, not standard menus.
  • Always pair with a usemap on the image.
  • Use responsive-friendly alternatives for mobile when possible (image maps are fixed in size).

🏁 Summary

The <area> tag is a specialized but powerful HTML element for creating clickable regions in an image using an image map. While not common in modern responsive design, it remains useful for diagrams, floor plans, games, or interactive illustrations.

🎯 Use <area> with <map> and <img usemap> to build meaningful image interactivity.