我正在尝试模拟这里完成的这个版本的粘性页脚 https://getbootstrap.com/docs/4.1/examples/sticky-footer/
这是我的html代码
<body>
@Html.Partial("Navigation/_Navigation")
<div class="container body-content">
<div class="content-container">
@RenderBody()
</div>
<footer>
© @DateTime.Now.Year - Stardocs Services
</footer>
</div>
</body>
这是我的CSS
html {
}
body {
padding-top: 50px;
margin-bottom: 50px;
}
/* Set padding to keep content from hitting the edges */
.body-content {
padding-top: 20px;
padding-left: 15px;
padding-right: 15px;
}
.content-container {
}
/*Footer*/
footer {
position: absolute;
bottom: 0;
left:0;
width: 100%;
height: 50px;
line-height: 50px;
background-color: #f5f5f5;
}
当我在桌面模式下查看它时,它会很好地固定在底部。但是,当我调整屏幕大小时,该栏看起来像这样:
我不确定如何继续我所做的。
最佳答案
你需要添加
.body-content {
min-height: 100vh;
padding-bottom: 50px;
position: relative;
}
另外,你应该删除
body { margin-bottom: 50px; }
关于html - 无法基于 Bootstraps sticky footer for mobile 创建粘性页脚,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52511748/