【发布时间】:2018-02-05 07:51:57
【问题描述】:
我需要在我的页面上放置一个粘性页脚,但是我没有为我的页脚设置一个明确的高度。在较小的屏幕上 - 行调整大小和页脚变得更长。
因此,getbootstrap 提供的默认粘性页脚示例不起作用,因为它需要固定的页脚高度。
有什么方法可以实现吗?
/* Sticky footer styles
-------------------------------------------------- */
html {
position: relative;
min-height: 100%;
}
body {
/* Margin bottom by footer height */
margin-bottom: 60px;
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
/* Set the fixed height of the footer here */
height: 60px;
line-height: 60px; /* Vertically center the text there */
background-color: #f5f5f5;
}
/* Custom page CSS
-------------------------------------------------- */
/* Not required for template or sticky footer method. */
body > .container {
padding: 60px 15px 0;
}
.footer > .container {
padding-right: 15px;
padding-left: 15px;
}
code {
font-size: 80%;
}
【问题讨论】:
-
不是重复的,这是个老问题,而且这个问题是 bootstrap 4 特有的。
标签: html css twitter-bootstrap bootstrap-4 sticky-footer