如何让iframe背景色透明

来源:互联网 发布:java公司贷款培训骗局 编辑:程序博客网 时间:2024/05/02 06:04

如何让iframe背景色透明

框架页文件设置:
<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" 有效


[html] view plain copy
  1. <iframe id="iframeRight" src="/111.html" scrolling="no" width="100%" height="100%" frameborder="0" allowTransparency="true"></iframe>  


111.html 如下:
[html] view plain copy
  1. <style>  
  2. body{  
  3. background-color:Transparent;  
  4. }  
  5. </style>  
  6. <div style="width:144px;height:557px;" id="divFloat1">  
  7.   <img src="/image/fd_4.png" usemap="#Map20" border="0" />  
  8. </div>     
0 0
原创粉丝点击