HTML <area> Tag
The <area> tag identifies the active areas of the image map. Tag description, tag attributes and usage examples.
The <area> tag identifies the active areas (coordinates, shape, size, etc.) of the image map, defined by the <map> tag. When you click on the active area of the image, a certain action takes place, for example, switching to a page with detailed information.
The <area> tag is always placed inside the <map> tag. Active areas can overlap, in which case the area that appears later in the DOM order is activated when clicked.
Syntax
The <area> tag is empty, which means that the closing tag isn’t required. But in XHTML, the <area> tag must be closed (<area />).
Example of the HTML <area> tag:
HTML tag <area>
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
</head>
<body>
<p>Click on the logo or on one of the logo item to watch it closer:</p>
<img src="/uploads/media/news_gallery/0001/01/thumb_316_news_gallery_list.jpeg" width="250" height="150" alt="block" usemap="#blockmap" />
<map name="blockmap">
<area shape="circle" coords="50,32,25" alt="html" href="/uploads/media/book_gallery/0001/01/d450f0358f947dffb3af91195c3002600d74101b.png" />
<area shape="circle" coords="218,115,25" alt="css" href="/uploads/media/book_gallery/0001/01/25521e981b34da57c8f51baddc5b76351b855818.png" />
<area shape="circle" coords="195,32,28" alt="php" href="/uploads/media/book_gallery/0001/01/4bbee6698c4884f25c46010d61b658dd62d2c04f.png" />
<area class="homepage" shape="rect" coords="35,55,90,90" alt="php" href="https://www.w3docs.com/" />
</map>
</body>
</html>Attributes
| Attribute | Value | Description |
|---|---|---|
| alt | text | Specifies an alternate text for the active area. |
| coords | x1,y1,x2,y2 | x,y,radius | x1,y1,...,xn,yn | Specifies the coordinates of the active area. Values depend on the shape: rect (upper left and lower right corners), circle (center and radius), or poly (polygon vertices). |
| download | filename | Indicates that when you click on a specific area, the file must be downloaded. |
| href | URL | Specifies the reference for the transition. |
| hreflang | language_code | Defines the language of the referenced document. Used only with href. |
| nohref | (none) | Specifies an area that does not contain a reference. Not supported in HTML5. |
| rel | alternate | author | bookmark | help | license | next | nofollow | noreferrer | prefetch | prev | search | tag | Establishes a link between the current and linked documents. |
| shape | rect | circle | poly | Defines the shape of the area. |
| target | _blank | _self | _top | _parent | frame_name | Specifies how the linked document should be opened. frame_name is not supported in HTML5. |
| type | media_type | Specifies the MIME-type of the linked document. |
The <area> tag supports also the Global attributes and the Event Attributes.
Practice
What is the purpose of the HTML area tag and what are its attributes?