【问题标题】:HTML Page scrollable without any content没有任何内容的 HTML 页面可滚动
【发布时间】:2018-11-14 20:28:20
【问题描述】:

我使用引导程序(仅导航栏和页脚)制作了一个简单的 html 页面。现在网站可以滚动了……为什么?

https://www.checkmobility.de

这是我的页脚 CSS:

/* Sticky footer styles
-------------------------------------------------- */
html {
  position: relative;
  min-height: 100%;
}
body {
  margin-bottom: 60px; /* Margin bottom by footer height */
}
.footer {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 50px; /* Set the fixed height of the footer here */
  line-height: 50px; /* Vertically center the text there */
  background-color: #f5f5f5;
}


/* Custom page CSS
-------------------------------------------------- */
/* Not required for template or sticky footer method. */

.container {
  width: auto;
  max-width: 680px;
  padding: 0 15px;
}

谢谢:)

【问题讨论】:

    标签: html bootstrap-4 footer scrollable


    【解决方案1】:

    由于在页脚中使用 line-height,会导致溢出。使用overflow:auto修复它...

    .footer {
      position: absolute;
      bottom: 0;
      width: 100%;
      height: 50px; /* Set the fixed height of the footer here */
      line-height: 50px; /* Vertically center the text there */
      background-color: #f5f5f5;
      overflow: auto;
    }
    

    https://www.codeply.com/go/PvhX4Z7ZYx

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-03-27
      • 1970-01-01
      • 1970-01-01
      • 2015-04-13
      • 1970-01-01
      • 2011-05-16
      • 1970-01-01
      • 2016-09-04
      相关资源
      最近更新 更多