Contents
This section is normative.
The Client-side Image Map Module provides elements for client side image maps. It requires that the Image Module (or another module that supports the img
element) be included. The
Client-side Image Map Module supports the following elements:
Elements | Attributes | Minimal Content Model |
---|---|---|
a& | coords (CDATA), shape ("rect" | "circle" | "poly" | "default") | n/a |
input& | usemap (IDREF) | Note: Only when the Forms module is included |
map | I18N, Events, class (NMTOKEN), id* (ID), title (CDATA) | ((Heading | Block) | area)+ |
object& | usemap (IDREF) | Note: Only when the object module is included |
When this module is used, the map element is added to the Inline content set of the Text Module.
Implementation: DTD
The area element defines a geometric region associated with an image map, and optionally associates that region with events or external references.
Attributes
Coordinates are relative to the top, left corner of the object. All values are of type Length. All values are separated by commas.
The map element specifies a client-side image map (or other navigation mechanism) that may be associated with another object. An image map is associated with an element via the element's usemap attribute. The map element may be used without an associated image for general navigation mechanisms.
Attributes
Several non-textual elements let authors specify alternate text to serve as content when the element cannot be rendered normally. Specifying alternate text assists users without graphic display terminals, users whose browsers don't support forms, visually impaired users, those who use speech synthesizers, those who have configured their graphical user agents not to display images, etc.
While alternate text may be very helpful, it must be handled with care. Authors should observe the following guidelines:
The presence of the usemapattribute for an object implies that the object being included is an image. Furthermore , when the object element has an associated client-side image map, user agents may implement user interaction with the object solely in terms of the client-side image map. This allows user agents (such as an audio browser or robot) to interact with the object without having to process it; the user agent may even elect not to retrieve (or process) the object. When an object has an associated image map, authors should not expect that the object will be retrieved or processed by every user agent.
The map element content model allows authors to combine the following:
When a map element contains mixed content (both area elements and block-level content), user agents must ignore the area elements.
Authors should specify an image maps's geometry completely with area elements, or completely with a elements, or completely with both if content is mixed. Authors may wish to mix content so that older user agents will handle map geometries specified by area elements and new user agents will take advantage of richer block content.
If two or more defined regions overlap, the region-defining element that appears earliest in the document takes precedence (i.e., responds to user input).
User agents and authors should offer textual alternates to graphical image maps for cases when graphics are not available or the user cannot access them. For example, user agents may use alt text to create textual links in place of a graphical image map. Such links may be activated in a variety of ways (keyboard, voice activation, etc.).
In the following example, we create a client-side image map for the object element. We do not want to render the image map's contents when the object is rendered, so we "hide" the map element within the object element's content. Consequently, the map element's contents will only be rendered if the object cannot be rendered.
<html xmlns="http://www.w3.org/2002/06/xhtml2"> <head> <title>The cool site!</title> </head> <body> <p src="navbar1.png" type="image/png" usemap="#map1"> <map id="map1"> <nl> <label>Navigate the site:</label> <li href="guide.html" shape="rect" coords="0,0,118,28"> Access Guide</li> <li href="shortcut.html" shape="rect" coords="118,0,184,28"> Go</li> <li href="search.html" shape="circle" coords="184,200,60"> Search</li> <li href="top10.html" shape="poly" coords="276,0,276,28,100,200,50,50,276,0"> Top Ten</li> </nl> </map> </p> </body> </html>
We may want to render the image map's contents even when a user agent can render the object. For instance, we may want to associate an image map with an object element and include a text navigation bar at the bottom of the page. To do so, we define the map element outside the object:
<html> <head> <title>The cool site!</title> </head> <body> <p> src="navbar1.gif" type="image/gif" usemap="#map1"> ...the rest of the page here... <map id="map1"> <p>Navigate the site: <A href="guide.html" shape="rect" coords="0,0,118,28">Access Guide</a> | <A href="shortcut.html" shape="rect" coords="118,0,184,28">Go</A> | <A href="search.html" shape="circle" coords="184,200,60">Search</A> | <A href="top10.html" shape="poly" coords="276,0,276,28,100,200,50,50,276,0">Top Ten</A> </map> </body> </html>
In the following example, we create a similar image map, this time using the area element. Note the use of alt text:
<p><object data="navbar1.gif" type="image/gif" usemap="#map1"> <p>This is a navigation bar. </object> <map name="map1"> <area href="guide.html" alt="Access Guide" shape="rect" coords="0,0,118,28"> <area href="search.html" alt="Search" shape="rect" coords="184,0,276,28"> <area href="shortcut.html" alt="Go" shape="circle" coords="184,200,60"> <area href="top10.html" alt="Top Ten" shape="poly" coords="276,0,276,28,100,200,50,50,276,0"> </map>
The following example illustrates how image maps may be shared.
Nested object elements are useful for providing fallbacks in case a user agent doesn't support certain formats. For example:
<p> <object data="navbar.png" type="image/png"> <object data="navbar.gif" type="image/gif"> text describing the image... </object> </object>
If the user agent doesn't support the PNG format, it tries to render the GIF image. If it doesn't support GIF (e.g., it's a speech-based user agent), it defaults to the text description provided as the content of the inner object element. When object elements are nested this way, authors may share image maps among them:
<P> <object data="navbar.png" type="image/png" usemap="#map1"> <object data="navbar.gif" type="image/gif" usemap="#map1"> <map name="map1"> <p>Navigate the site: <a href="guide.html" shape="rect" coords="0,0,118,28">Access Guide</a> | <a href="shortcut.html" shape="rect" coords="118,0,184,28">Go</a> | <a href="search.html" shape="circle" coords="184,200,60">Search</a> | <a href="top10.html" shape="poly" coords="276,0,276,28,100,200,50,50,276,0">Top Ten</a> </map> </object> </object>
The following example illustrates how anchors may be specified to create inactive zones within an image map. The first anchor specifies a small circular region with no associated link. The second anchor specifies a larger circular region with the same center coordinates. Combined, the two form a ring whose center is inactive and whose rim is active. The order of the anchor definitions is important, since the smaller circle must override the larger circle.
<map name="map1"> <p> <A shape="circle" coords="100,200,50">I'm inactive.</A> <A href="outer-ring-link.html" shape="circle" coords="100,200,250">I'm active.</A> </map>
Similarly, the nohref attribute for the area element declares that geometric region has no associated link.