Latest web development tutorials

HTML area coords 屬性

HTML area 標籤參考手冊 HTML <area>標籤

實例

帶有可點擊區域的圖像映射:

<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>

嘗試一下»

瀏覽器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主流瀏覽器都支持coords 屬性。


定義和用法

coords 屬性規定區域的x 和y 坐標。

coords屬性與shape屬性配合使用,來規定區域的尺寸、形狀和位置。

提示:圖像左上角的坐標是"0,0"。


HTML 4.01 與HTML5之間的差異

NONE.


語法

<area coords="value">

屬性值

描述
x1,y1,x2,y2 如果shape 屬性設置為"rect",則該值規定矩形左上角和右下角的坐標。
x,y,radius 如果shape 屬性設置為"circ",則該值規定圓心的坐標和半徑。
x1,y1,x2,y2,..,xn,yn 如果shape 屬性設置為"poly",則該值規定多邊形各邊的坐標。 如果第一個坐標和最後一個坐標不一致,那麼為了關閉多邊形,瀏覽器必須添加最後一對坐標。


HTML area 標籤參考手冊 HTML <area>標籤