我发现很多地方都提到了 Ryan Fait 的技术:http://ryanfait.com/sticky-footer/
还找到了这个:http://matthewjamestaylor.com/blog/keeping-footers-at-the-bottom-of-the-page
但它们看起来都过时且老旧,即使代码确实有效。有没有更简单的东西可以在现代浏览器中运行?
最佳答案
这是制作粘性页脚的更简洁的方法,不需要额外的包装器,并且适用于包括 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%;
}
关于css - 当内容很短时强制页脚到浏览器底部的现代技术是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16571062/