2012-10-24 70 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 –