Syntax | This element uses separate opening and closing tags.<map>...</map> |
---|---|
Usage | The <map> tag is used to specify a client-side image map. The <area>, <map>, and <img> tags can work together to allow clickable areas to be defined within an image. First an image is specified using an <img> tag. Then a <map> tag is used to specify a client-side image map. The <map> tag contains one ore more <area> tags. Each <area> tag defines a clickable area and an associated link. The usemap attribute in the <img> tag is used to point to the <map> tag. This is accomplished by setting the name and id attributes in the <map> tag to the corresponding value. HTML <map> example. <p> <img usemap="#shapes" src="shapes.gif" alt="picture shapes"> <map name="shapes" id="shapes"> <area shape="rect" coords="2,14,103,78" href="rect.html" alt="rectangle"> <area shape="circle" coords="164,47,32" href="circle.html" alt="circle"> <area shape="poly" coords="220,0,232,83,296,34" href="tri.html" alt="poly"> </map> </p> XHTML <map> example. <p> <img usemap="#shapes" src="shapes.gif" alt="picture shapes" /> <map name="shapes" id="shapes"> <area shape="rect" coords="2,14,103,78" href="rect.html" alt="rectangle" /> <area shape="circle" coords="164,47,32" href="circle.html" alt="circle" /> <area shape="poly" coords="220,0,232,83,296,34" href="tri.html" alt="poly" /> </map> </p> |
Content Model | The <map> element can contain the following tags between its opening and closing tags. <address>
<area>
<blockquote>
<center>
<del>
<dir>
<div>
<dl>
<fieldset>
<form>
<h1>
<h2>
<h3>
<h4>
<h5>
<h6>
<hr>
<ins>
<isindex>
<menu>
<noframes>1
<noscript>
<ol>
<p>
<pre>
<script>2
<table>
<ul>
Notes:1. The <map> element can contain the <noframes> tag when using DTD Transitional documents but not Strict or Frameset documents. 2. The <map> element can contain the <script> tag when using XHTML but not HTML. 3. Red tags have been deprecated and are allowed in DTD Transitional and Frameset documents but not Strict documents. |
Required | Tag Specific | Core | Focus | Events | Language |
---|---|---|---|---|---|
id1 name2 | class style title | onclick ondblclick onkeydown onkeypress onkeyup onmousedown onmousemove onmouseout onmouseover onmouseup | dir lang xml:lang3 | ||
Notes: 1. Required in XHTML but not in HTML. 2. Required in HTML but not in XHTML. Deprecated in XHTML. 3. XHTML only. |
Attribute | Description |
---|---|
id | The id attribute is used to specify a name for the image map in XHTML documents. The name attribute is used to specify a name for the image map in HTML documents. Both name and id attributes can be set to the same value. The usemap attribute in the <img> tag is used to point to the <map> tag. This is accomplished by setting the name and id attributes in the <map> tag to the corresponding value. HTML <map> tag example. <p>
<img usemap="#shapes" src="shapes.gif" alt="picture shapes">
<map name="shapes" id="shapes">
<area shape="rect" coords="2,14,103,78" href="rect.html" alt="rectangle">
<area shape="circle" coords="164,47,32" href="circle.html" alt="circle">
<area shape="poly" coords="220,0,232,83,296,34" href="tri.html" alt="poly">
</map>
</p> XHTML <map> tag example. <p>
<img usemap="#shapes" src="shapes.gif" alt="picture shapes" />
<map name="shapes" id="shapes">
<area shape="rect" coords="2,14,103,78" href="rect.html" alt="rectangle" />
<area shape="circle" coords="164,47,32" href="circle.html" alt="circle" />
<area shape="poly" coords="220,0,232,83,296,34" href="tri.html" alt="poly" />
</map>
</p> Note: Required in XHTML but not in HTML. Note: This is a required attribute. |
name | The name attribute is used to specify a name for the image map in HTML documents. The id attribute is used to specify a name for the image map in XHTML documents. Both name and id attributes can be set to the same value. The usemap attribute in the <img> tag is used to point to the <map> tag. This is accomplished by setting the name and id attributes in the <map> tag to the corresponding value. HTML <map> example. <p>
<img usemap="#shapes" src="shapes.gif" alt="picture shapes">
<map name="shapes" id="shapes">
<area shape="rect" coords="2,14,103,78" href="rect.html" alt="rectangle">
<area shape="circle" coords="164,47,32" href="circle.html" alt="circle">
<area shape="poly" coords="220,0,232,83,296,34" href="tri.html" alt="poly">
</map>
</p> XHTML <map> example. <p>
<img usemap="#shapes" src="shapes.gif" alt="picture shapes" />
<map name="shapes" id="shapes">
<area shape="rect" coords="2,14,103,78" href="rect.html" alt="rectangle" />
<area shape="circle" coords="164,47,32" href="circle.html" alt="circle" />
<area shape="poly" coords="220,0,232,83,296,34" href="tri.html" alt="poly" />
</map>
</p> Note: Required in HTML but not in XHTML. Deprecated in XHTML. Note: This is a required attribute. |
class | The class attribute assigns a class name to a tag. The class name does not need to be unique. More than one tag can have the same class name. This allows style sheets or scripts to reference multiple tags with a single class name. See class Example |
style | The style attribute specifies styles for the tag. For Cascading Style Sheets (CSS), the syntax is name:value. Each name:value pair is separated by semicolons. See style Example |
title | The title attribute specifies additional information about the tag. It is common for browsers to display the title when the pointing device stops over the object. See title Example |
onclick | The onclick attribute specifies a script to be run when the object is clicked with a mouse or other pointing device. See onclick Example |
ondblclick | The ondblclick attribute specifies a script to be run when the object is double clicked with a mouse or other pointing device. See ondblclick Example |
onkeydown | The onkeydown attribute specifies a script to be run when a key is pressed down. See onkeydown Example |
onkeypress | The onkeypress attribute specifies a script to be run when a key is pressed and released. See onkeypress Example |
onkeyup | The onkeyup attribute specifies a script to be run when a key is released. See onkeyup Example |
onmousedown | The onmousedown attribute specifies a script to be run when the mouse button, or other pointing device button, is pressed while over the object. See onmousedown Example |
onmousemove | The onmousemove attribute specifies a script to be run when the mouse, or other pointing device, is moved while it is over the object. See onmousemove Example |
onmouseout | The onmouseout attribute specifies a script to be run when the mouse, or other pointing device, is moved away from an object after being over it. See onmouseout Example |
onmouseover | The onmouseover attribute specifies a script to be run when the mouse, or other pointing device, is moved onto the object. See onmouseover Example |
onmouseup | The onmouseup attribute specifies a script to be run when the mouse button, or other pointing device button, is released while over the object. See onmouseup Example |
dir | The dir attribute tells the browser whether the text should be displayed from left-to-right or right-to-left. It does not reverse the direction of the characters, like the <bdo> tag does, but it can help the browser to determine if the text should be aligned on the left side or the right side. See dir Example |
lang | The lang attribute specifies a language. This attribute can help the browser to correctly display text. This attribute can also be useful for braille translation software, speech synthesizers, dictionary definitions, etc. See lang Example |
xml:lang | The xml:lang attribute specifies a language for XHTML documents. This attribute can help the browser to correctly display text. This attribute can also be useful for braille translation software, speech synthesizers, dictionary definitions, etc. See xml:lang Example Note: XHTML only. |
<map> example. |