Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

<map>

翻译正在进行中。

这个HTML <map> 属性<area> 属性一起使用来定义一个图像映射(一个可点击的链接区域).

Content categories Flow content, phrasing content, palpable content.
Permitted content Any transparent element.
Tag omission 不允许,开始标签和结束标签都不能省略。
Permitted parent elements Any element that accepts phrasing content.
DOM interface HTMLMapElement

Attributes

This element includes the global attributes.

name
The name 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 name attribute must not be a compatibility-caseless match for the value of the name attribute of another map element in the same document. If the id attribute is also specified, both attributes must have the same value.

Examples

<map name="example-map-1">
  <area shape="circle" coords="200,250,25" href="another.htm" />
  <area shape="default" />
</map>

Specifications

Specification Status Comment
WHATWG HTML Living Standard
<map>
Living Standard  
HTML5
<map>
Recommendation  
HTML 4.01 Specification
<map>
Recommendation Initial definition

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 1.0 1.0 (1.7 or earlier)[1]
5.0 (5.0)[2]
17.0 (17.0)[3]
(Yes) 1.0 1.0
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 1.0 1.0 (1.0)[1]
5.0 (5.0)[2]
17.0 (17.0)[3]
(Yes) 1.0 1.0

[1] Starting in Gecko 5.0 (Firefox 5.0 / Thunderbird 5.0 / SeaMonkey 2.2), empty maps are no longer skipped over in favor of non-empty ones when matching when in quirks mode. For example, consider the following HTML:

<map></map>
<map>
  <area shape="rect" coords="25,25,75,75" href="#fail">
</map>
<img usemap="#a" src="image.png">

[2] Prior to Gecko 5.0, the <img> element would have matched to the second, non-empty map. Now it matches against the first one, even though it's empty.

[3] From Firefox 17 the default styling of the <map> HTML element is display: inline; and no more display: block;. This matches the behavior of the other browsers and was already the case in quirks mode.

See also

文档标签和贡献者

 此页面的贡献者: naive233
 最后编辑者: naive233,