如何讓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" 有效


<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


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章