<area>
tag defines the area inside an image map. An image map has predefined clickable areas.
This <area>
tag can only be used between the <map>
. Almost every latest browser (Google Chrome, Mozilla Firefox, or Safari) supports area elements in HTML.
<area attribute1 attribute2 ...>
The <area>
tag supports both types of attributes, i.e., Global and Event Attributes in HTML.
Attribute | Value | Detail |
href | URL | Hyperlink target for area. |
alt | text | Alternate text for the area is also required when href is present. |
coords | coordinates | Specifies the coordinates of area. |
download | filename | Get target ready to download. |
media | media query | Optimize target URL for specific device/media. |
hreflang | language code | Specified the target url language. |
type | media type | Media type of target URL. |
shape |
| Occupied area shape. |
target |
| Destination i.e. where the target URL open. |
<area>
coords attributeShape | Values |
---|---|
circle | x, y, radius |
rect | x1, y1, x2, y2 |
poly | x1, y1, x2, y2, …, xn, yn |
Consider the following code example:
By clicking on the coffee image, you will be redirected to the coffee’s Wikipedia page. And on clicking the phone image, you will be redirected to the smartphone’s webpage.
Lines six and seven tell us the complete use of the <Area>
element in the HTML document.