【问题标题】:Bootstrap Footer sticky bottom - scrollbarBootstrap 页脚粘底 - 滚动条
【发布时间】:2014-07-02 20:50:02
【问题描述】:

我在这里徘徊我做错了什么。我试图摆脱滚动条(垂直)。我试过去掉填充物,甚至调整高度。无法弄清楚我可能错过了什么。非常感谢帮助

http://jsfiddle.net/jSB53/embedded/result/

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

html, body {
    height: 100%;/* The html and body elements cannot have any padding or margin. */
}
/* Wrapper for page content to push down footer */
#wrap {
    min-height: 100%;
    height: auto !important;
    height: 100%;
    /* Negative indent footer by it's height */
    margin: 0 auto -70px;
     /* Pad bottom by footer height */
  padding: 0 0 60px;
}

#footer {
    background-color: #ee3124;
    color: #FFFFFF;
    height: 70px;
    padding: 20px 0 0;
}

.navbar-default {
    border-bottom: 5px #ee3124 solid;
    background-color: #fff;
    margin-top: 20px;
    height: 33px;
    -webkit-box-shadow: 0 4px 4px -2px #C7C7C7;
   -moz-box-shadow: 0 4px 4px -2px #C7C7C7;
        box-shadow: 0 4px 4px -2px #C7C7C7;

}

/* Lastly, apply responsive CSS fixes as necessary */
@media (max-width: 767px) {
#footer {
    margin-left: -20px;
    margin-right: -20px;
    padding-left: 20px;
    padding-right: 20px;
}
}

【问题讨论】:

  • 你是指横向还是纵向还是两者兼而有之?
  • 滚动条仅垂直出现 =)))
  • 底部有一个hori滚动条,因为如果您的媒体查询中有负边距。
  • 自己想通​​了。这是我这边的一个错误。向导致滚动条出现的 div 添加边距。我的错。

标签: css twitter-bootstrap sticky-footer


【解决方案1】:

由于您已将页脚的高度设置为 70 像素,因此您还需要调整 #wrap 底部填充..

/* Wrapper for page content to push down footer */
#wrap {
  min-height: 100%;
  height: auto !important;
  height: 100%;
  /* Negative indent footer by its height */
  margin: 0 auto -70px;
  /* Pad bottom by footer height */
  padding: 0 0 70px;
}

http://www.bootply.com/rl77rU0NgR

【讨论】:

    猜你喜欢
    • 2013-07-27
    • 2016-04-21
    • 2012-07-23
    • 2011-01-12
    • 2019-04-23
    • 2012-07-18
    • 2013-11-04
    • 2018-11-22
    • 1970-01-01
    相关资源
    最近更新 更多