gpt4 book ai didi

html - div高度在div内100%

转载 作者:太空宇宙 更新时间:2023-11-03 20:52:16 25 4
gpt4 key购买 nike

我得到了下面的代码,但它不起作用:

<div id="wrap">
<div class="navigation">
<ul>
<li>
</li>
</ul>
</div>


<div id="main">
Content
</div>
</div>

我希望包裹的高度为 100%。这很好用。但是,一旦我尝试将#main div 也设置为 100% 高度,它就不会。这个 div 总是折叠到内容的高度。

html{height:100%;}
body{overflow-y:scroll; margin:0px; padding:0px; height:100%;}
#wrap{
min-height: 100%; /* Mindesthöhe für moderne Browser */
height:auto !important; /* Important Regel für moderne Browser */
height:100%; /* Mindesthöhe für den IE */
width:100%;
position:absolute;
overflow:hidden;
}


#main{
width: 980px !important;


height:100%; /* IE6: treaded as min-height*/
min-height:100%; /* real browsers */
height:auto !important;


}

有人可以帮我解决这个问题吗?提前致谢

最佳答案

更改wrap 的样式。 Live Demo

#wrap {
min-height: 100%; /* Minimum height for modern browsers */
height:100%; /* Minimum height for IE */
width:100%;
position:absolute;
overflow:hidden;
border:1px solid blue;
}

关于html - div高度在div内100%,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14714222/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com