所以在我的代码中,我有一个粘性的页脚。而粘脚则有min-height
为100%
的#wrap容器。但min-height
不能在包装div内的对象上使用height:100%
。CSS - 身高:100%vs最小身高:100%;
所以我加了height:100%
,但是当窗口高度太小时,通过使页脚在包装div中的内容滚动而与布局混乱。
任何人都有此修复?
<div id="wrap">
<div id="main">
<div id="content">
</div>
</div>
<div class="clearfooter"></div>
</div>
<div id="footer">
</div>
CSS:
*{
padding: 0px;
margin: 0px;
}
html, body {
height: 100%;
}
body{
color: #FFF;
background-image:url('../images/black_denim.png');
}
#wrap {
min-height: 100%;
margin-bottom: -200px;
position: relative;
}
#topBanner{
width: 200px;
margin: 0px auto;
}
.clearfooter {
height: 200px;
clear: both;
}
/* footer */
#footer {
position: relative;
height: 200px;
width: 100%;
min-width: 960px;
}
我也知道你可以做'位置:绝对;顶部:0;底部:0;'来获得效果,但是,因为它是绝对的,页脚将会像内容那样行事,如果它也是不存在的话小。 –