HTML Tags – Area Tag

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">
    alt="My rectangle box">

Example :

<!DOCTYPE html>
  <title>HTML area tag</title>
  <img src="" width="300" height="300" alt="CSTechbook" usemap ="#define">
  <map name="define" >
    <area shape ="rect" coords ="0,0,115,90" href ="" alt="croud"/>
    <area shape ="poly" coords ="10,10,162,82,175,100,181,102,175,148,122,146" href ="" alt="water"/>

Output :

HTML coding for a website !!!

Click to Learn More about – HTML Tutorial for beginners

<area> Tag Attributes

<area> tag supported following specific attributes.

1alttextSpecifies the text to identify the render the image.
2hrefurlSpecifies URL link to information about render image.
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.
define sharp of specify render image.
5coordscoords_valueSpecifies the coordinates of an image map.

Global Attributes

<area> tag also support global attributes.

1idunique_nameDeclared unique id for an element.
2classclass_nameDeclared one or more classnames for an element.
3stylestylesCSS inline styles specify an element.
4titletitleSpecify extra details of element contain, this will display as a “tooltip” for an elements.

Event Attributes

<area> tag support following Event attributes.

1onfocusscriptelement gets focus on object when script tobe run.
2onblurscriptelement lose the focus on object when scrip tobe run.
3onclickscriptclicked on object when script tobe run.
4ondblclickscriptdouble click on object when script tobe run.
5onkeydownscriptkey is pressed when script tobe run.
6onkeypressscriptkey is pressed over element then released when script tobe run.
7onkeyupscriptkey is released over element when script tobe run.
8onmousedownscriptmouse button was pressed over an element when script tobe run.
9onmouseoutscriptmouse pointer release over an element when script tobe run.
10onmousemovescriptrun mouse pointer moved when script tobe run.
11onmouseoverscriptrun mouse pointer move over when script tobe run.
12onmouseupscriptmouse button is released when script tobe run.

Browser Compatibility

6Internet ExplorerYes