关于如何在iframe中设置背景颜色为透明

来源:互联网 发布:淘宝哪家四件套好 编辑:程序博客网 时间:2024/06/09 23:48

方法一:
可以设置嵌入页面的背景色,另外可以设置iframe的背景透明,看到的颜色是框架页的背景色。
1. 框架页

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

2.transparent.htm页

  1. <body bgColor="transparent">

方法二:
在transparentBody.htm文件的标签中,我已经加入了style=”background-color=transparent” 通过以下四种IFRAME的写法我想大概你对iframe背景透明效果的实现方法应该会有个清晰的了解:

  1. <IFRAME ID="Frame1" SRC="transparentBody.htm" allowTransparency="true"></IFRAME> 
  2. <IFRAME ID="Frame2" SRC="transparentBody.htm" allowTransparency="true" STYLE="background-color: green"></IFRAME>
  3. <IFRAME ID="Frame3" SRC="transparentBody.htm"></IFRAME>
  4. <IFRAME ID="Frame4" SRC="transparentBody.htm" STYLE="background-color: green"></IFRAME>
原创粉丝点击