设计创意

CSS贴在底部的布局

css09
CSS 贴在底部的布局, 它始终在页面的底部。
http://www.cssstickyfooter.com
看这个网页的底部,为什么会跑到那儿去呢?
即使内容很少的情况下,它也始终在页面的底部。
否则页面底部将留下大量空白。
下面是它实现的代码:

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;
clear:both;}
兼容性Hack:
.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 */

本文由 Jackchen Design 1984 作者:jackchen 发表,转载请注明来源!

关键词:, , , ,

热评文章

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注