• 1
预览模式: 普通 | 列表

来源:http://www.jb51.net/css/196706.html

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;}

查看更多...

分类:特色软件 | 固定链接 | 禁止评论 | 引用: 0 | 查看次数: 2366

footer 贴在底部的布局实现代码

来源:http://www.jb51.net/css/21807.html

footer位置自适应

复制代码
代码如下:

<div id="wrap">
<div id="main" class="clearfix">
<div id="content">
ccc
</div>
<div id="side">
sss
</div>
</div>
</div>
<div id="footer">
fff
</div>



复制代码
代码如下:

html, body, #wrap {height: 100%;}
body > #wrap {height: auto; min-height: 100%;}
#main {padding-bottom: 150px;} /* 必须使用和footer相同的高度 */
#footer {position: relative;
margin-top: -150px; /* footer高度的负值 */
height: 150px;
background: #ddd;
clear: both;}
.clearfix:after {content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;}
.clearfix {display: inline-block;}
/* Hides from IE-mac \*/
* html .clearfix {height: 1%;}
.clearfix {display: block;}
/* End hide from IE-mac */
分类:特色软件 | 固定链接 | 禁止评论 | 引用: 0 | 查看次数: 2290
  • 1
 
扫码领红包!领到大红包的小伙伴赶紧使用哦!