2011-02-13 12 views

回答

0

使用這樣的CSS規則,使IFRAME填補它的父母和沒有邊界:

#MainBack iframe { width: 100%; height: 100%; border: none; } 

Internet Explorer不尊重border設置,因此您還需要在標記中設置frameborder屬性:

<a href="#computing" onclick="document.getElementById('MainBack').innerHTML = '<iframe src=&quot;test.html&quot; frameborder=&quot;0&quot;></iframe>'">Computing</a> 
+0

這個工程,但我得到了iframe下的巨大差距。 – 2011-02-13 22:52:28

+0

@Mark Brewerton:包含的元素需要設置特定的高度,否則iframe的高度設置不會產生任何影響。或者,如果包含元素將適應它,則可以爲iframe指定一個設置高度。 – Guffa 2011-02-14 01:51:23

0

HTML

<iframe src="" scrolling="no" frameborder="0" allowtransparency="true"></iframe> 

CSS

border:none; 
overflow:hidden; 
width:450px; 
height:35px;" 

Allowtransparecy在IE中使用,否則你會看到頁面背景不同的背景..

編輯: 添加逃脫版

<a href="#computing" onclick="document.getElementById('MainBack').innerHTML = '<iframe src=\'http://www.google.com\' scrolling=\'no\' frameborder=\'0\' allowtransparency=\'true\'></iframe>'">Computing</a>  
<div id="MainBack"></div> 
相關問題