usemap (HTML attribute)
| Depr. | Version |
|---|---|
| No | HTML 4 |
| IE5.5+ | FF1+ | SA1.3+ | OP9.2+ |
|---|---|---|---|
| Full | Full | Full | Full |
Syntax
Description
The
usemap attribute tells the browser which of the
map elements in the document it
should refer to. The hotspots defined (using the area element) act as overlays on the object.
These areas are similar to links (created with the a element), and allow the user to click to
go to the page identified in the respective area’s
href attribute. They’re also
keyboard-navigable.
The usemap
attribute is only used in the object element when the
type of object is an image (.gif,
.jpg, or
.png).
Example
This
usemap attribute references a map named
"dogmap":
<p>
<object data="giant-dog.jpg" usemap="#dogmap"
height="225" width="300" border="0"></object>
<map name="dogmap" id="dogmap">
<area shape="circle" coords="216,120,24"
href="http://tirauinfo.homestead.com/TheBigDog.html"
alt="Click on the nose for more info about this big dog!"/>
</map>
</p>
Value
This attribute takes as
its value a reference to the map’s name attribute
in form of an "#" character plus the
"name", like so:
usemap="#dogmap"
Compatibility
| Internet Explorer | Firefox | Safari | Opera | |||||||
|---|---|---|---|---|---|---|---|---|---|---|
| 5.5 | 6.0 | 7.0 | 1.0 | 1.5 | 2.0 | 1.3 | 2.0 | 3.0 | 9.2 | 9.5 |
| Full | Full | Full | Full | Full | Full | Full | Full | Full | Full | Full |
It causes no compatibility issues, and has excellent support across all tested browsers.
User-contributed notes
There are no comments yet.
Add a note
To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.