如何将HTML表拉伸到浏览器窗口高度的100%? [英] How to stretch an HTML table to 100% of the browser window height?
问题描述
我使用表格来设计我的网页布局。我想要表填充页面,即使它不包含很多内容。这里是我使用的CSS:
I'm using a table to design the layout of my web page. I want the table to fill the page even if it doesn't contain much content. Here's the CSS I'm using:
html, body {
height: 100%;
margin: 0;
padding: 0;
}
#container {
min-height: 100%;
width: 100%;
}
我在页面代码中放置如下:
And I place something like this in the page code:
<table id="container">
<tr>
<td>
...
这适用于Opera 9,但不适用于Firefox 2或Internet Explorer是否有一个简单的方法使这个解决方案适用于所有流行的浏览器?
This works for Opera 9, but not for Firefox 2 or Internet Explorer 7. Is there a simple way to make this solution work for all popular browsers?
(添加 id =container
到 td
没有帮助。)
推荐答案
当设置 #container $ c时,
height
属性代替 min-height
$ c>。一旦数据太大,表格将自动增长。
Just use the height
property instead of the min-height
property when setting #container
. Once the data gets too big, the table will automatically grow.
这篇关于如何将HTML表拉伸到浏览器窗口高度的100%?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!