如何让iframe背景色透明

来源:互联网 发布:墓碑设计软件 编辑:程序博客网 时间:2024/06/09 14:30
框架页文件设置:
<body style="background-color:transparent" > 或 <body bgColor="transparent">
方法一:
<iframe src="about.htm" width="100%" height="100%" align="center" scrolling="auto" frameborder="0" style="filter:chroma(color=#ffffff)" >
</iframe>
缺点:iFrame里的白色的都变透明了。
方法二:(个人推荐使用)
<iframe src="about.htm" width="100%" height="100%" align="center" scrolling="auto" frameborder="0" allowTransparency="true" >
</iframe>
还有其它几个写法,可以比较一下:
<iframe src="about.htm" allowTransparency="true" style="background-color: green"> </iframe >
<iframe src="about.htm"> </iframe >

<iframe src="about.htm" style="background-color: green"> </iframe >  


经测试,<body style="background-color:transparent" >  +  allowTransparency="true" 有效


<iframe id="iframeRight" src="/111.html" scrolling="no" width="100%" height="100%" frameborder="0" allowTransparency="true"></iframe>


111.html 如下:
<style>body{background-color:Transparent;}</style><div style="width:144px;height:557px;" id="divFloat1">  <img src="/image/fd_4.png" usemap="#Map20" border="0" /></div>   



参考页面:http://hi.baidu.com/lansesansan/item/4ad02f13bb02d9acfeded5a9


原创粉丝点击