html - 将页脚固定在底部 - 即使正文没有内容

标签 html css twitter-bootstrap twitter-bootstrap-3

我想知道如何将页脚固定在底部,即使页面没有内容。在发表这篇文章之前,我搜索了解决方案,但没有找到真正的解决方案。 新手解决方案可能是将 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/

相关文章:

javascript - $scope 在 Angular js 中不起作用

javascript - 使用 css 链接复选框动画

html - div 正文中的 angular2 url 链接

html - 如何在 Bootstrap 3 中为两列整体制作边框?

twitter-bootstrap - 在 Bootstrap 中动态重新排列面板位置。

HTML 下拉列表(选择),在每个值(选项)后带有文本换行和边框

css - 如何在悬停/焦点上显示 "bounce"社交导航图标?

html - 使用 grid-column-start 会导致网格元素的自动放置停止工作

html - Bootstrap 帮助(链接和子页面)

html - 根据屏幕宽度调整导航栏最小高度