HTML <map> element 用于 <area> 元素以定义图像映射 (可点击的链接区域)。

The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.

内容类别 流内容 , 措词内容 ,可触及内容。
准许内容 任何 transparent 元素。
Tag omission None, both the starting and ending tag are mandatory.
Permitted parents Any element that accepts 措词内容 .
Implicit ARIA role 无对应角色
Permitted ARIA roles No role permitted
DOM 接口 HTMLMapElement

属性

此元素包括 全局属性 .

名称
名称 attribute gives the map a name so that it can be referenced. The attribute must be present and must have a non-empty value with no space characters. The value of the 名称 attribute must not be a compatibility-caseless match for the value of the 名称 attribute of another <map> element in the same document. If the id attribute is also specified, both attributes must have the same value.

范例

<map name="primary">
  <area shape="circle" coords="75,75,75" href="left.html">
  <area shape="circle" coords="275,75,75" href="right.html">
</map>
<img usemap="#primary" src="https://placehold.it/350x150" alt="350 x 150 pic">
					

结果

Expected live example output

The live example above should appear similar to the following images (when using your keyboard tab key):

对于 left.html link:

对于 right.html link

规范

规范 状态 注释
HTML 实时标准
The definition of '<map>' in that specification.
实时标准
HTML5
The definition of '<map>' in that specification.
推荐
HTML 4.01 Specification
The definition of '<map>' in that specification.
推荐 初始定义

浏览器兼容性

The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
map Chrome 完整支持 1 Edge 完整支持 12 Firefox 完整支持 1 注意事项
完整支持 1 注意事项
注意事项 Before Firefox 5, in Quirks Mode, empty maps were no longer skipped over in favor of non-empty ones when matching.
注意事项 Before Firefox 17, the default styling of the <map> HTML element was display: block; . This is now display: inline; and matches the behavior of the other browsers. It was already the case in Quirks Mode.
IE 完整支持 Yes Opera 完整支持 Yes Safari 完整支持 1 WebView Android 完整支持 1 Chrome Android 完整支持 18 Firefox Android 完整支持 4 Opera Android 完整支持 Yes Safari iOS 完整支持 Yes Samsung Internet Android 完整支持 1.0
名称 Chrome 完整支持 1 Edge 完整支持 12 Firefox 完整支持 1 IE 完整支持 Yes Opera 完整支持 Yes Safari 完整支持 1 WebView Android 完整支持 1 Chrome Android 完整支持 18 Firefox Android 完整支持 4 Opera Android 完整支持 Yes Safari iOS 完整支持 Yes Samsung Internet Android 完整支持 1.0

图例

完整支持

完整支持

见实现注意事项。

见实现注意事项。

另请参阅

元数据

  • 最后修改: