网页制作 
首页 > 网页制作 > 浏览文章

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

(编辑:jimmy 日期: 2024/5/8 浏览:3 次 )
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 */
上一篇:li float后IE下有空格
下一篇:CSS对IE6、IE7、IE8支持详细的易用的参考
友情链接:杰晶网络 DDR爱好者之家 南强小屋 黑松山资源网 白云城资源网