HTML area标签 coords 属性

返回到:HTML area标签

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”,则该值规定多边形各顶点的值。如果第一个坐标和最后一个坐标不一致,那么为了关闭多边形,浏览器必须添加最后一对坐标。

实例

带有可点击区域的图像映射:

<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 属性。

返回到:HTML area标签

terry

这个人很懒,什么都没有留下~

Share
Published by
terry

Recent Posts

自定义指令:聊聊vue中的自定义指令应用法则

今天我们来聊聊vue中的自定义…

9 小时 ago

聊聊Vue中@click.stop和@click.prevent

一起来学下聊聊Vue中@cli…

1 周 ago

Nginx 基本操作:启动、停止、重启命令。

我们来学习Nginx基础操作:…

1 周 ago

Vue3:手动清理keep-alive组件缓存的方法

Vue3中手动清理keep-a…

2 周 ago

聊聊React和Vue组件更新的实现及区别

React 和 Vue 都是当…

3 周 ago