2009-11-08 174 views
8

我的頁面上有一個iframe。我已在其上插入背景圖片。但它沒有顯示圖像。這是我的代碼。iframe背景圖片

<iframe scrolling="auto" allowtransparency="true" name="main" style="width:100%;height:90%" style="background-image:url(img/bg2.jpg)"> </iframe> 
+0

您使用的是樣式屬性,試戴合併成一個 – jerjer 2009-11-08 07:00:20

回答

14

試試這個:

<iframe scrolling="auto" allowtransparency="true" name="main" style="width:100%;height:90%;background-image:url(img/bg2.jpg)"> </iframe> 

,如果它不工作,移動背景圖像iframe的容器。

+0

謝謝它的工作正常,但仍然不能在IE瀏覽器上工作在Firefox上。 – 2009-11-08 07:07:03

+0

+1「allowtransparency =」true「在IE中爲我做了訣竅 – hinekyle 2013-04-17 11:53:02

-4

試試這個..它應該工作(在IE/Firefox的/谷歌克羅默測試)

<div><img src="a.JPG"></div> 

<div> 
<iframe style="display:none" width="325" height="276" frameborder="0" scrolling="auto"></iframe> 
</div> 
-1

包裝你的iframe與股利,並把它的一些類。 例如:

<div class="wrap"> 
<iframe style="display:none" width="325" height="276" frameborder="0" scrolling="auto"></iframe> 
</div> 

在CSS: .wrap {背景:網址(somepicture);} .wrap IFRAME {不透明度:0;}