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>
以下の「自分で試してみてください」の例をもっと見てください。
定義と使用法
タグは、<map>
画像マップを定義するために使用されます。画像マップは、クリック可能な領域がある画像です。
<map>
要素の必須のname属性は、 <img>のusemap属性に関連付けられ、画像とマップの間に関係を作成します。
この<map>
要素には、画像マップのクリック可能な領域を定義するいくつかの<area>要素が含まれています。
ブラウザのサポート
Element | |||||
---|---|---|---|---|---|
<map> | Yes | Yes | Yes | Yes | Yes |
属性
Attribute | Value | Description |
---|---|---|
name | mapname | Required. Specifies the name of the image map |
グローバル属性
この<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リファレンス:マップオブジェクト
デフォルトのCSS設定
ほとんどのブラウザは<map>
、次のデフォルト値で要素を表示します。
map {
display: inline;
}