当前位置: 首页 > 图文教程 > 网页制作 > CSS样式表 > footer 贴在底部的布局实现代码

CSS样式表
shtml精简教程让你知道什么是shtml
很不错的 CSS Hack 又学了一招
Default style sheet for HTML 4
资料:Unicode 汉字内码对应表
解决CSS中 display 与 visibility 的区别
制作WEB在线编辑器-插入HTML标签
编写纯 CSS 弹出菜单的原理及实现 By shawl.qiu
关于《精通css》之几个不错的注意事项
position:relative/absolute无法冲破的等级
CSS样式表常用小技巧收藏
收集的web页面html中常用的特殊符号大全
bc1998录制的css视频教程推荐新手看下
dl+ol应用分析
li的简单应用
web打印的另类方法
用CSS实现的一张图完成的按钮效果
文章内容页广告浮于左上角的解决办法
广告放在文章页左上角的解决办法二
iframe的使用用法
FIF互动帮助手册系列-HTML手册 flash版

CSS样式表 中的 footer 贴在底部的布局实现代码


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-10-27   浏览: 336 ::
收藏到网摘: n/a

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 */