2011-02-13 43 views
2

我有一個使用背後的背景圖像的iFrame。在Firefox上,背景是透明的,我可以看到背景圖片。在IE中,Iframe中的背景默認爲白色。有沒有解決這個問題?在IE中沒有iFrame透明度?

例子:

<td width="80px" class="voting" align="center"><div id="votingIframeDiv"> 
    <iframe id="votingIframe" frameborder="0" allowTransparency="true" vspace="0" hspace="0" marginwidth="0" marginheight="0" width="80" height="70" scrolling="no" src="vote/index.php?userid=89&fishid=<?php echo $row['id'];?>" > 
     </iframe></div> 
    </td> 

回答

2

確保兩個IFRAME及其源BODY元素應用了background:transparent樣式規則:

<iframe id="votingIframe" frameborder="0" allowTransparency="true" style="background:transparent" ... ></iframe> 

,並在源:

<body style="background:transparent"> 

PS:以上CSS樣式是內聯只是舉例。

4

是否有此修復程序?

是的,IE有非標準allowtransparency屬性。

<IFRAME ID="Frame1" SRC="transparentBody.htm" allowTransparency="true"> 
</IFRAME> 
+0

我試過這個,不知何故它不起作用 – user547794 2011-02-13 10:32:35

+0

@user example? `` – 2011-02-13 10:33:24

+0

確定已添加代碼 – user547794 2011-02-13 10:37:11

0

是的,你可以解決這個問題,但它也取決於iframe的起源的樣式表,如果iframe的來源有一個BG在CSS設置,這將覆蓋allowTransparency="true"

這可能是一個長鏡頭,但嘗試把allowTransparency="true"位於iframe標記的末尾。

注意:在我的測試中allowTransparency還沒有在IE6中工作。

0

將allowTransparency ='true'後,如果你沒有得到任何愛試試確保你的風格=「背景:透明」。