html - 如何在内容 DIV 处停止粘性页脚

标签 html css footer sticky-footer

我一直在调整我的粘性页脚,希望在它到达 #body div 时停止它,但到目前为止,我一直没有成功。在大多数情况下,它通常不会覆盖内容,但 on this page ,它经常这样做。

如果可能的话,我想将它固定在窗口底部,但我能想到的唯一其他解决方案是固定位置。有什么建议吗?

最佳答案

好吧,您可以通过多种方式应用固定位置/粘性页脚。一种选择是仅使用 CSS,如 Twitter Bootstraps Sticky Footer example .这可能是最简单的实现。

  /* The html and body elements cannot have any padding or margin. */
  html,body { height: 100%; }

  /* Wrapper for page content to push down footer */
  #wrap {
    min-height: 100%;
    height: auto !important;
    height: 100%;
    margin: 0 auto -100px; /* Negative indent footer by it's height */
  }

  /* Set the fixed height of the footer here */
  #push,#footer{ height:100px }
  #footer {}

关于html - 如何在内容 DIV 处停止粘性页脚,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16259636/

相关文章:

javascript - 从表单条目获取变量以添加到链接?

html - inline-block 在 Chrome 中与容器的边框重叠

css - ion-content 指令滚动 div 不显示数据

html - 如何使用 padding/margin 来移动一个 div?

html - CSS 下拉列表 UL LI A

javascript - 如何加快我的 jQuery 粘性页脚的加载时间?

html 没有链接 css

php - 如何使用 PHP 设置 HTML 选择框的选定值

css - 页脚位置底部问题

twitter-bootstrap - 使用 Angular 4 和 Bootstrap 4 在底部设置页脚(适应内容)