Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE
     ❯   

HTML <map> 标签


示例

一个带有可点击区域的图片地图

<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">
</map>
自己试试 »

以下有更多“自己试试”示例。


定义和用法

The <map> 标签用于定义图片地图。图片地图是一幅带有可点击区域的图片。

<map> 元素所需的 name 属性与 <img> 的 usemap 属性相关联,并在图片和地图之间建立关联。

<map> 元素包含多个 <area> 元素,它们定义图片地图中的可点击区域。


浏览器支持

元素
<map>


属性

属性 描述
name mapname 必需。指定图片地图的名称

全局属性

<map> 标签还支持 HTML 中的全局属性.


事件属性

<map> 标签还支持 HTML 中的事件属性.


更多示例

示例

另一个带有可点击区域的图片地图

<img src="planets.gif" width="145" height="126" alt="Planets"
usemap="#planetmap">

<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">
</map>
自己试试 »

相关页面

HTML DOM 参考: Map 对象


默认 CSS 设置

大多数浏览器将使用以下默认值显示 <map> 元素

map {
  display: inline;
}

×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
[email protected]

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
[email protected]

W3Schools is optimized for learning and training. Examples 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-2024 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.