在我的代码中,我有一个固定页脚。这个固定页脚具有#wrap容器,并且min-height为100%。但是,在wrap div内部的对象上使用height:100%是无效的。
因此,我添加了height:100%,但它会影响布局,使得当窗口高度过小时,页脚会滚动到wrap div中的内容上方。
是否有任何解决方法?
因此,我添加了height:100%,但它会影响布局,使得当窗口高度过小时,页脚会滚动到wrap 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;
}
position:absolute;top:0;bottom:0;
来实现这个效果,但是由于它是绝对定位的,如果页脚太小,它仍然会像内容不存在一样。 - Cow