我想知道如何将页脚固定在底部,即使页面没有内容。在发表这篇文章之前,我搜索了解决方案,但没有找到真正的解决方案。 新手解决方案可能是将 margin-top 放在顶部,但这可能会使整页看起来很难看。顺便说一句,提前致谢,这是我的代码。
<footer class"footer">
//content
</footer>
.footer {
position: relative;
}
最佳答案
如果您的页面没有内容, 您可以将页脚固定到屏幕底部。
<footer class"footer">
//content
</footer>
.footer {
position: absolute;
bottom: 0;
}
jsfiddle:https://jsfiddle.net/1La17zsr/
关于html - 将页脚固定在底部 - 即使正文没有内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48508983/