对于div来扩展全高 [英] For div to extend full height
本文介绍了对于div来扩展全高的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有一个方法,我可以使用一个div扩展到全高度?
Is there a method I can use for a div to extend to full height? I've got a sticky footer in it as well.
这里是网页:网站已移除。我在说的中间部分是白色div,具有CSS值的midcontent:
Here's the web page: Website removed. The middle bit I'm talking about is the white div, midcontent which has CSS values:
.midcontent{
width:85%;
margin:0 auto;
padding:10px 20px;
padding-top:0;
background-color:#FFF;
overflow:hidden;
min-height:100%;
max-width:968px;
height:100%;
}
code>没有工作。此外,所有父容器都设置了高度。
So yes, obviously height:100%
didn't work. Additionally, ALL parent containers have height set.
以下是一般结构:
<body>
<div id="wrap">
<div id="main">
<div class="headout">
<div class="headimg"></div>
</div>
<div class="midcontainer"></div>
</div>
</div>
<div id="footer">
<div class="footer"></div>
</div>
推荐答案
你还记得设置html和body的高度标签在你的CSS?这通常是我的DIVs扩展到全高:
Did you remember setting the height of the html and body tags in your CSS? This is generally how I've gotten DIVs to extend to full height:
<html>
<head>
<style type="text/css">
html,body { height: 100%; margin: 0px; padding: 0px; }
#full { background: #0f0; height: 100% }
</style>
</head>
<body>
<div id="full">
</div>
</body>
</html>
这篇关于对于div来扩展全高的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文