最小高度的div与内容一起扩展

时间:2015-03-09 19:48:49

标签: html css height

我有一个最小高度为70%的div。在那个div我有一个div我放置我的内容。 当内容超过70%时,我的div会增长并使页脚进一步下降。而这正是我想要的。我唯一的问题是,当我放置内容的div为空时,div为空。我希望这个div有或没有内容100%已满,如果内容超过100%仍然能够扩展。但是怎么样?对于900px高度屏幕和600px高度屏幕以及更小的屏幕,它需要100%高度。

问题是以下两个div:

    #wrapper
{
    background-color: red;
    width: 100%;
    height: 70%;

}

#content
{
margin-left: 50%;
min-height: 100%;
background-color: yellow;

}

HTML:

  <div id="wrapper">
<div id="content">
So this is the div that needs to be able to expand. And it needs to be 100% height, even if its not 100% filled like now or empty 
</div>
</div>

2 个答案:

答案 0 :(得分:0)

&nbsp;放入空div

答案 1 :(得分:0)

我知道我需要做什么,在第二个div我需要增加高度:100vh;

相关问题