举报投诉联系我们 手机版 热门标签 名动网
您的位置:名动网 > html中shape的属性 HTML DOM Area shape 属性

html中shape的属性 HTML DOM Area shape 属性

2023-03-24 18:20

html中shape的属性 HTML DOM Area shape 属性

html中shape的属性

HTML中的shape属性是用来指定图形的形状,它可以让浏览器知道图片的形状,从而使浏览器能够正确地显示图片。shape属性可以用于指定图片的形状,如圆形、方形、三角形或其他复杂的几何图形。

<img src="image.jpg" shape="circle">  // 将图片显示为圆形
<img src="image.jpg" shape="rectangle">  // 将图片显示为长方形
<img src="image.jpg" shape="polygon" coords="x1,y1,x2,y2,x3,y3...">  // 将图片显示为多边形

shape属性有三个可选值:circle、rectangle和polygon。circle表示圆形;rectangle表示长方形;polygon表示多边形。如果使用polygon作为shape属性的取值,还需要使用coords属性来指定多边形的各个顶点的位置。

shape属性还可以用于指定链接包含在其中的区域。例如,如果一张图片上有几个不同的区域,则可以使用shape属性将这些区域分别链接到不同的URL上。

HTML DOM Area shape 属性

Area shape 属性

Area 对象参考手册 Area 对象

定义和用法

shape 属性可设置或返回某个区域的 shape 属性值。

shape 属性指定了图像映射中某个区域的形状。

语法

areaObject.shape=value

shape 属性可以是以下值:

描述
default指定整个地区
rect定义了一个矩形区域
circle定义了一个圆形区域
poly定义一个多边形区域


浏览器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主要浏览器都支持 shape 属性


实例

实例

下面的例子可返回图像映射中 "Venus" 区域的形状:

<html>
<body>

<img src="planets.gif" width="145" height="126" usemap="#planetmap">

<map name="planetmap">
<area id="venus" shape="circle" coords="124,58,8" alt="Venus" href="venus.htm">
</map>

<p>The shape for the "Venus" area is:
<script>
document.write(document.getElementById("venus").shape);
</script>
</p>

</body>
</html>

以上实例输出结果:

The shape for the "Venus" area is: circle



Area 对象参考手册 Area 对象
阅读全文
以上是名动网为你收集整理的html中shape的属性 HTML DOM Area shape 属性全部内容。
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。
相关文章
© 2024 名动网 mdwl.vip 版权所有 联系我们