4

我发现很多地方提到了 Ryan Fait 的技术:http ://ryanfait.com/sticky-footer/

还找到了这个: http: //matthewjamestaylor.com/blog/keeping-footers-at-the-bottom-of-the-page

但即使代码确实有效,它们似乎都过时且老套。在现代浏览器中是否有更简单的东西?

4

2 回答 2

1

这是制作粘性页脚的更清洁的方式,不需要额外的包装器,并且适用于包括 IE8 在内的所有浏览器。

html {
 position: relative;
 min-height: 100%;
}

body {
 margin: 0 0 110px; /* bottom = footer height + margin of the footer */
}

footer {
 position: absolute;
 left: 0;
 bottom: 0;
 margin-top:10px;
 height: 100px;
 width: 100%;
}
于 2014-06-04T08:38:15.030 回答
0

简单的!使用position:absolute;bottom:0;

于 2013-05-15T18:13:54.610 回答