【问题标题】:can't affix footer when using mmenu使用 mmenu 时无法添加页脚
【发布时间】:2017-04-20 18:01:34
【问题描述】:

我有问题。在对站点的侧页进行编码时,我无法将页脚绑定到站点的地下室。我使用引导类。尝试使用此类代码时:

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;
  background-color: #f5f5f5;
}

页脚要么保持原位,要么关闭内容,接近导航栏。 这个问题怎么解决?

之前 https://i.stack.imgur.com/qeg7Q.png

使用代码后 https://i.stack.imgur.com/XnnaS.png

附:我为糟糕的英语道歉

【问题讨论】:

    标签: javascript jquery css mmenu


    【解决方案1】:

    100% 的高度不像你想象的那样工作。在这种情况下,您正在寻找 vh 单位。我也会将它们应用于body,而不是html。

    *{box-sizing: border-box;}
    
    body {
      /* Margin bottom by footer height */
      margin: 0;
      padding: 0;
      min-height: 100vh;
      position: relative;
    }
    footer {
      position: absolute;
      width: 100%;
      /* Set the fixed height of the footer here */
      height: 60px;
      background-color: #f5f5f5;
      bottom: 0;
    }
    <body>
      content
      <footer>
        footer
      </footer>
    </body>

    【讨论】:

    • 我试过了。但一切都保持不变。我有这样一个网站结构:
    猜你喜欢
    • 2021-12-27
    • 2015-11-24
    • 2011-03-25
    • 1970-01-01
    • 2015-07-21
    • 1970-01-01
    • 2014-01-04
    • 2011-06-15
    • 1970-01-01
    相关资源
    最近更新 更多