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

建站知识 2021-07-03 08:42www.168986.cn长沙网站建设
footer位置自适应

复制代码
代码如下:

<div id="wrap">
<div id="main" class="clearfix">
<div id="content">
c
</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-: -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 /

Copyright © 2016-2025 www.168986.cn 狼蚁网络 版权所有 Power by