HTML Tags

HTML <map> Tag

Topic: HTML5 Tags ReferencePrev|Next

Description

The <map> tag specifies a client-side image map.

An image map is a list of coordinates relating to a specific image, created in order to hyperlink areas of the image to various destinations (as opposed to a normal image link, in which the entire area of the image links to a single destination).

For example, a map of the world may have each country hyperlinked to further information about that country. The intention of an image map is to provide an easy way of linking various parts of an image without dividing the image into separate image files.

The following table summarizes the usages context and the version history of this tag.

Placement: Inline
Content: Block and <area>
Start/End Tag: Start tag: required, End tag: required
Version: HTML 3.2, 4, 4.01, 5

Syntax

The basic syntax of the <map> tag is given with:

HTML / XHTML: <map name="text"> ... </map>

The example below shows the <map> tag in action.

<img src="shapes.png" usemap="#shapes" alt="Geometrical Shapes">
<map name="shapes">
    <area shape="circle" coords="40,40,40" href="circle.html" alt="Circle">
    <area shape="poly" coords="148,2,104,80,193,80" href="triangle.html" alt="Triangle">
    <area shape="rect" coords="226,2,323,80" href="rectangle.html" alt="Rectangle">
    <area shape="poly" coords="392,2,352,32,366,80,418,80,432,32" href="pentagon.html" alt="Pentagon">
</map>

Note: An image may be associated with an image map, via a usemap attribute. The usemap attribute, if specified, must be a string beginning with a hash character (#) followed by the value of the name attribute of the <map> element.


Tag-Specific Attributes

The following table shows the attributes that are specific to the <map> tag.

Attribute Value Description
name text Assigns a name to the image map.

Global Attributes

Like all other HTML tags, the <map> tag supports the global attributes in HTML5.


Event Attributes

The <map> tag also supports the event attributes in HTML5.


Browser Compatibility

The <map> tag is supported in all major modern browsers.

Browsers Icon

Basic Support—

  • Firefox 1+
  • Google Chrome 1+
  • Internet Explorer 2+
  • Apple Safari 1+
  • Opera 4+

Further Reading

See tutorial on: HTML Images.

Related tag: <area>, <img>.

Bootstrap UI Design Templates Property Marvels - A Leading Real Estate Portal for Premium Properties