微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

css – 如何在没有最小高度,粘性页脚或javascript的情况下将包含的页脚保留在短页面的底部

我有60页都有相同的页脚,包括PHP中.内容量从高300px到2000不等.我不认为这是可能的,但是如果我可以让页脚坐在浏览器窗口的底部,如果页面比窗口短,并且行为正常(推到底部),那将是很好的,否则,只用CSS.谢谢.

解决方法

我知道这篇文章很老了,但我找到了一个很好的资源来解决这个问题.

http://ryanfait.com/sticky-footer/

这里只是css:

* {
    margin: 0;
}
html,body {
    height: 100%;
}
.wrapper {
    min-height: 100%;
    height: auto !important;
    height: 100%;
    margin: 0 auto -155px; /* the bottom margin is the negative value of the footer's height */
}
.footer,.push {
    height: 155px; /* .push must be the same height as .footer */
}

/*

Sticky Footer by Ryan Fait
http://ryanfait.com/

*/

祝好运.

原文地址:https://www.jb51.cc/css/216031.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。