我有一個叫做「內容」的div,我希望至少佔據整個窗口的高度。最小高度100%不能在內部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;
}
用Firebug,我覈實,確實現在佔用了整個頁面(甚至當有頁面上沒有內容就在我想要的。)
然而,問題是,內容並沒有佔據整個高度,而只是內容的大小。
編輯:似乎工作在鉻7.0.517.41,但不是在Firefox 3.6.10(問題似乎發生在所有版本的Firefox 3.6.x和可能以前的版本以及)。
試過了,對ff 3.6.10沒有任何影響。 = [ – 2010-10-22 07:30:06
其實nvm它的工作,它是高度:auto!important;那是在殺死它。我想知道爲什麼它不影響鉻。 – 2010-10-22 07:35:11
我知道的唯一的事情是高度計算是非常危險的,這取決於瀏覽器... =/ – MatTheCat 2010-10-22 07:40:14