2012-08-15 69 views

回答

4

让我们假设你有下面的HTML:

<!doctype html> 
<div> 
<iframe src="http://www.example.com"></iframe> 
</div> 
<div> 
<iframe src="http://www.example.org"></iframe> 
</div> 

现在,如果你想有(像你的榜样页)第一个iframe中有一个特定的高度和第二填充文档的其余部分,您可以使用表格中display属性的值:

html { 
height: 100%; 
} 

body { 
display: table; 
height: 100%; 
width: 100%; 
margin: 0; 
} 

div { 
display: table-row; 
} 

div:first-child { 
height: 100px; 
} 

div:last-child { 
height: 100%; 
} 

iframe { 
display: table-cell; 
width: 100%; 
height: 100%; 
border: none; 
} 
+0

这种方法对旧版浏览器(即IE6,7和8)有效吗?这是如何“未来证明”? – RLH 2012-11-02 14:18:49

相关问题