首页 > Web开发 > 详细

Footer固定在页面底部(CSS)

时间:2016-04-27 22:39:10      阅读:381      评论:0      收藏:0      [点我收藏+]
<style type="text/css">
  #wapper{                    
        position: relative;    /*重要!保证footer是相对于wapper位置绝对*/  
        height: auto;           
        min-height: 100%;       
    }
  #main-content{ 
        background:grey;    
        padding-bottom: 60px;   /*重要!给footer预留的空间*/  
    } 
  #footer{ 
    background: green; 
    width: 100%; 
    position: absolute; 
    bottom: 0;              /* 关键 */ 
    height:60px;             /* 此方法的缺点:页脚的高度需要手动调 */
  } 
</style>


<body style="margin:0">
    <div id="wapper">  
        <!-- 主要内容 -->  
        <div id="main-content">
            这里是内容
        </div>  
        <!-- 页脚 -->  
        <div id="footer">  
            这里是页脚
        </div>  
    </div>  
 </body>

 

 

 

Footer固定在页面底部(CSS)

原文:http://www.cnblogs.com/roronoa-sqd/p/5440485.html

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