Tutorials 参考 练习 Menu
Paid Courses

HTML <map> Tag


An image map, with clickable areas:

<img src="workplace.jpg" alt="Workplace" usemap="#workmap" width="400" height="379">

<map name="workmap">
  <area shape="rect" coords="34,44,270,350" alt="Computer" href="computer.htm">
  <area shape="rect" coords="290,172,333,250" alt="Phone" href="phone.htm">
  <area shape="circle" coords="337,300,44" alt="Cup of coffee" href="coffee.htm">
来试试吧 »

More "来试试吧" examples below.

Definition and Usage

The <map> tag is used to define an image map. An image map is an image with clickable areas.

The required name attribute of the <map> element 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

<map> Yes Yes Yes Yes Yes


Attribute Value Description
name mapname Required. Specifies the name of the image map

Global Attributes

The <map> tag also supports the Global Attributes in HTML.

Event Attributes

The <map> tag also supports the Event Attributes in HTML.

More 示例


Another image map, with clickable areas:

<img src="planets.gif" width="145" height="126" alt="Planets"

<map name="planetmap">
  <area shape="rect" coords="0,0,82,126" href="sun.htm" alt="Sun">
  <area shape="circle" coords="90,58,3" href="mercur.htm" alt="Mercury">
  <area shape="circle" coords="124,58,8" href="venus.htm" alt="Venus">
来试试吧 »

Related Pages

HTML DOM reference: Map Object

Default CSS Settings

Most browsers will display the <map> element with the following default values:

map {
  display: inline;

W3Schools is optimized for learning and training. 示例 might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2021 by Refsnes Data. All Rights Reserved.
W3Schools is Powered by W3.CSS.