如何在Boostrap中制作粘性页脚?

问题描述 投票:0回答:1

我目前正在开发一个Django项目,我想在页面底部设置一个页脚(粘性页脚)。

寻找论坛,我找到了一种解决方案,可以“完成工作”(即,将页脚粘贴在页面底部),但是有一个尴尬的行为,那就是要知道它根据屏幕的大小遮盖了某些按钮(例如, dataTable的分页按钮)

这对于我的功能测试(硒)也很尴尬,因为当黄油被页脚遮盖时,某些测试失败(请参见红色框中的图像)

是否有引导程序页脚或解决此问题的方法?

enter image description here

/* Sticky footer styles
-------------------------------------------------- */

.asteriskField{
  display: none;
}
form .alert ul li{
  list-style: none;
}
form .alert ul {
  margin:0;
  padding: 0;
}
body > div > div.col-6 > div > div > h2 {
  font-size: 20px;
}
.footer {
  position: fixed;
  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;
  /*background-color: red;*/

}
django bootstrap-4 sticky-footer
1个回答
0
投票

我是django开发人员(您用django标记了这个问题,但并没有真正的关联,所以如果这不是您想要的,请不要怪我:

html {
    position: relative;
    min-height: 100%;
    scroll-behavior: smooth;
}
body {
    margin-bottom: 56px;
}
.footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 56px;
}
© www.soinside.com 2019 - 2024. All rights reserved.