HTML <area> coords 屬性
實例
帶有可點擊區域的圖像映射:
<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>
流覽器支持
所有主流流覽器都支持 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",則該值規定多邊形各頂點的值。如果第一個座標和最後一個座標不一致,那麼為了關閉多邊形,流覽器必須添加最後一對座標。 |