首页 > 其他 > 详细

footer置底

时间:2016-05-13 11:52:48      阅读:204      评论:0      收藏:0      [点我收藏+]

html代码:

<div class="container"> 
    <div cass="header"></div> 
    <div class="body"></div> 
    <div class="footer"></div> 
</div> 

第一种情况:footer随着滚动条的滚动而滚动 

.container{
    position:relative;
    width:100%;
    min-height:100%;
} 
.body{
    padding-bottom:50px;
} 
.footer{
    height:50px;
    position:absolute;
    bottom:0px;
    left:0px;
} 

第二种情况:footer始终在其底部固定 

.container{
    position:relative;
    width:100%;
    min-height:100%;
} 
.body{
    padding-bottom:50px;
} 
.footer{
    height:50px;
    position:fixed;
    bottom:0px;
    left:0px;
} 

注意: 
千万不能设置.container的高度为100%,否则将无法随滚动条的滚动而滚动.

footer置底

原文:http://www.cnblogs.com/answer-liu/p/5486838.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!