方法一:
可以设置嵌入页面的背景色,另外可以设置iframe的背景透明,看到的颜色是框架页的背景色。
1. 框架页
- <iframe allowTransparency="true" src="transparent.htm"></iframe>
2.transparent.htm页
- <body bgColor="transparent">
方法二:
在transparentBody.htm文件的标签中,我已经加入了style=”background-color=transparent” 通过以下四种IFRAME的写法我想大概你对iframe背景透明效果的实现方法应该会有个清晰的了解:
- <IFRAME ID="Frame1" SRC="transparentBody.htm" allowTransparency="true"></IFRAME>
- <IFRAME ID="Frame2" SRC="transparentBody.htm" allowTransparency="true" STYLE="background-color: green"></IFRAME>
- <IFRAME ID="Frame3" SRC="transparentBody.htm"></IFRAME>
- <IFRAME ID="Frame4" SRC="transparentBody.htm" STYLE="background-color: green"></IFRAME>