您现在的位置: 365建站网 > 365文章 > html中iframe框架的allowTransparency透明属性用法

html中iframe框架的allowTransparency透明属性用法

文章来源:365jz.com     点击数:1976    更新时间:2018-11-02 09:11   参与评论

IE5.5开始支持浮动框架的内容透明。如果想要为浮动框架定义透明内容,则必须满足下列条件。
1.与 iframe 元素一起使用的 allowTransparency 标签属性必须设置为 true。
2.在 iframe 内容源文档,background-color 或 body 元素的 bgColor 标签属性必须设置为 transparent。
具体步骤: 

1. 包含框架页的代码。

1

2

3

<body bgColor="#eeeeee">

<iframe allowTransparency="true" src="transparent.htm">

</iframe>

2.transparent.htm页的代码。

1

<body bgColor="transparent">


特别说明
本例主要是iframe对象的allowTransparency属性应用,在该属性设置为true并且iframe所载加页的背景颜色设置为transparent(透明)时iframe将透明化。
allowTransparency设置或获取对象是否可为透明。

bgColor 设置或获取对象的背景颜色。


有人说,被调用的页面的body中要加上style="background-color:transparent",其实是没有必要的,在IE5.5以上(不包括)版本中,已经没有必要使用。 


allowTransparency属性是针对iframe的特殊属性,仅对ie起到一定的作用,而其属性值,即上文提到的“true”则是不必须的,也就是说只要iframe中有allowTransparency属性存在,无论其值为多少,哪怕是“false”,也会对IE中iframe的透明起到作用,这也自然说明,其不用定义值也可以起到作用,那么在iframe只用加入“allowTransparency”即可。 


Html代码

<iframe src="iframe.html" width="600px" height="500px" allowtransparency  scrolling="no" frameborder="0"></iframe>


以上就是html中关于iframe的allowTransparency属性的用法


如对本文有疑问,请提交到交流论坛,广大热心网友会为你解答!! 点击进入论坛

发表评论 (1976人查看0条评论)
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
昵称:
最新评论
------分隔线----------------------------

快速入口

· 365软件
· 杰创官网
· 建站工具
· 网站大全

其它栏目

· 建站教程
· 365学习

业务咨询

· 技术支持
· 服务时间:9:00-18:00
365建站网二维码

Powered by 365建站网 RSS地图 HTML地图

copyright © 2013-2024 版权所有 鄂ICP备17013400号