HTML <map> Tag
Example
An image-map, with clickable areas:<img src="/images/353915main_image_1377_428-321.gif" alt="Planets" width="350" height="263" usemap="#planetmap"> <map id="planetmap" name="planetmap"> <area shape="rect" coords="203,104,343,241" alt="Sun" title="sun" href="http://xhtml.co.il/tryit/sun.html"> <area shape="circle" coords="92,98,56" alt="Mercury" title="Mercury" href="http://xhtml.co.il/tryit/mercury.html"> </map>
Definition and Usage
The <map> tag is used to define a client-side image-map. An image-map is an image with clickable areas.
The name attribute is required in the map element. This attribute is associated with the <img>'s usemap attribute and creates a relationship between the image and the map.
The map element contains a number of area elements, that defines the clickable areas in the image map.
Browser Support
The
<map> tag is supported in all major browsersDifferences Between HTML and XHTML
NONERequired Attributes
DTD indicates in which HTML 4.01/XHTML 1.0 DTD the attribute is allowed. S=Strict, T=Transitional, and F=Frameset.
| Attribute | Value | Description | DTD |
|---|---|---|---|
| name | mapname | Specifies the name for an image-map | STF |
Standard Attributes
Тег<map> поддерживает следующие стандартные атрибуты:| Attribute | Value | Description | DTD |
|---|---|---|---|
| class | classname | Specifies a classname for an element | STF |
| dir | rtl ltr | Specifies the text direction for the content in an element | STF |
| id | id | Specifies a unique id for an element | STF |
| lang | language_code | Specifies a language code for the content in an element | STF |
| style | style_definition | Specifies an inline style for an element | STF |
| title | text | Specifies extra information about an element | STF |
| xml:lang | language_code | Specifies a language code for the content in an element, in XHTML documents | STF |
More information about Standard Attributes.
Event Attributes
The<map> tag supports the following event attributes:| Attribute | Value | Description | DTD |
|---|---|---|---|
| onclick | script | Script to be run on a mouse click | STF |
| ondblclick | script | Script to be run on a mouse double-click | STF |
| onmousedown | script | Script to be run when mouse button is pressed | STF |
| onmousemove | script | Script to be run when mouse pointer moves | STF |
| onmouseout | script | Script to be run when mouse pointer moves out of an element | STF |
| onmouseover | script | Script to be run when mouse pointer moves over an element | STF |
| onmouseup | script | Script to be run when mouse button is released | STF |
| onkeydown | script | Script to be run when a key is pressed | STF |
| onkeypress | script | Script to be run when a key is pressed and released | STF |
| onkeyup | script | Script to be run when a key is released | STF |
| onblur | script | Script to be run when an element loses focus | STF |
| onfocus | script | Script to be run when an element gets focus | STF |
More information about Event Attributes.
Was this information helpful?

