What is an <area> tag in HTML ?
HTML <area> tag is used to create an area inside the image map.
What is an image map ?
Image map is an image with clickable areas.
Image map allows geometric areas on an image to be associated with hypertext link.
By default the <area> element inside an image map that has predefined clickable areas.
How <area> is implemented ?
HTML <area> tag is used for defining an area in an image map.
<area> elements are always nested inside a <map> tag.
“usemap” attribute in <img> is associated with the <map> element’s name attribute, and creates a relationship between the image and the map.
Syntax :
<img src ="/myImage.png" alt="My Image" usemap ="#my-imgmap">
<map name="my-imgmap">
<area
shape="rect"
coords="50,50,100,100"
href="/box/"
alt="My rectangle box">
</map>
Example :
<!DOCTYPE html>
<html>
<head>
<title>HTML area tag</title>
</head>
<body>
<img src="https://secureservercdn.net/192.169.221.188/s30.e0b.myftpupload.com/wp-content/uploads/2020/10/html5-title-cc-1.png" width="300" height="300" alt="CSTechbook" usemap ="#define">
<map name="define" >
<area shape ="rect" coords ="0,0,115,90" href ="https://s30.e0b.myftpupload.com/home" alt="croud"/>
<area shape ="poly" coords ="10,10,162,82,175,100,181,102,175,148,122,146" href ="https://s30.e0b.myftpupload.com/client-side-html-5/" alt="water"/>
</map>
</body>
</html>
Output :


HTML coding for a website !!!
Click to Learn More about – HTML Tutorial for beginners
<area> Tag Attributes
<area> tag supported following specific attributes.
Sno | Attributes | Value | Description |
---|---|---|---|
1 | alt | text | Specifies the text to identify the render the image. |
2 | href | url | Specifies URL link to information about render image. |
3 | target | _blank _parent _self _top | Loads the linked document in new window. Loads the linked document in the parent frame. Loads the linked document in the same window. Loads the linked document in the top up on same window. |
4 | shape | rect circle poly | define sharp of specify render image. |
5 | coords | coords_value | Specifies the coordinates of an image map. |
Global Attributes
<area> tag also support global attributes.
Sno | Attributes | Value | Description |
---|---|---|---|
1 | id | unique_name | Declared unique id for an element. |
2 | class | class_name | Declared one or more classnames for an element. |
3 | style | styles | CSS inline styles specify an element. |
4 | title | title | Specify extra details of element contain, this will display as a “tooltip” for an elements. |
Event Attributes
<area> tag support following Event attributes.
Sno | Attributes | Value | Description |
---|---|---|---|
1 | onfocus | script | element gets focus on object when script tobe run. |
2 | onblur | script | element lose the focus on object when scrip tobe run. |
3 | onclick | script | clicked on object when script tobe run. |
4 | ondblclick | script | double click on object when script tobe run. |
5 | onkeydown | script | key is pressed when script tobe run. |
6 | onkeypress | script | key is pressed over element then released when script tobe run. |
7 | onkeyup | script | key is released over element when script tobe run. |
8 | onmousedown | script | mouse button was pressed over an element when script tobe run. |
9 | onmouseout | script | mouse pointer release over an element when script tobe run. |
10 | onmousemove | script | run mouse pointer moved when script tobe run. |
11 | onmouseover | script | run mouse pointer move over when script tobe run. |
12 | onmouseup | script | mouse button is released when script tobe run. |
Browser Compatibility
Sno | Browser | Support |
1 | Chrome | Yes |
2 | Firefox | Yes |
3 | Edge | Yes |
4 | Opera | Yes |
5 | Safari | Yes |
6 | Internet Explorer | Yes |