【发布时间】:2011-04-29 00:35:06
【问题描述】:
我有一个名为“内容”的 div,我希望它至少占据窗口的整个高度。
所以我做的是这样的:
body
{
min-height:100%;
height:auto !important;
/* The following probably aren't relevant but I'll include them just in case */
min-width:600px;
color: #fff;
font-family:'lucida grande',verdana,helvetica,arial,sans-serif;
font-size:90%;
margin: 0;
}
div#content
{
min-height:100%;
/* The following probably aren't relevant but I'll include them just in case */
clear: both;
color: #333;
padding: 10px 20px 40px 20px;
position:relative;
background:url(/img/strawberry.png) right bottom no-repeat;
}
使用萤火虫,我验证确实现在占据了整个页面(即使页面上没有内容。正如我想要的那样)
但问题是,内容并没有占据 的整个高度,而是仅与其内部内容一样大。
编辑:似乎在 chrome 7.0.517.41 中有效,但在 firefox 3.6.10 中无效(问题似乎出现在 firefox 3.6.x 的所有版本中,也可能在以前的版本中出现)。
【问题讨论】: