2012-10-24 57 views
0
<div id="container"> 

    <div id="content"> 
    //my content 
    </div> 

</div> 

#container{ 
height:100%!important; 
min-height:700px!important; 
} 
#content{ 
height:100%!important; 
} 

我有一個內容div的容器div,不管我做什麼,我都無法得到內容div與容器div相同的高度。我錯過了什麼嗎?100%集裝箱內100%的高度?

感謝

+0

只是要清楚你的CSS是在頂部的樣式部分和的div是在體內,它不是在HTML你在這裏展示? –

回答

0

添加height:100%爲HTML和身體

html, body{height:100%} 

DEMO


您可以添加最小高度:700像素(或繼承)兒童格也。我希望它能做到這一點。

UPDATED DEMO

添加更多的內容內div來檢查height:100%效果含量增加時。

+0

不,不起作用。 – panthro

+0

你檢查演示嗎?它的工作 – Sowmya

+0

你的演示不包括min-height:700px!important; – panthro

0
<style> 
#container{ 
height:700px !important; 
border:1px solid red; 
} 
#content{ 
height:100%!important; 
border:1px solid green; 
} 
</style> 
<div id="container"> 
    <div id="content"> 
    //my content 
    </div> 

</div> 
+0

不,不起作用 – panthro

+0

我已經試過這個,它爲我工作..即使你的代碼也在爲我工作..你在哪個瀏覽器中檢查 –

+0

@ user1013512我編輯了我的解決方案,它對我的​​工作很好plz有一看 –

0

只是增加最小高度:繼承到內容風格

#content{ 
height:100%!important; 
min-height:inherit; 
} 
+0

好工作@RRcom Resty –