css - 容器 DIV 未超出窗口的原始高度

标签 css height

我将以下 CSS 用于容器 DIV,其中 html 的高度和 body 设置为 100%,但它没有超出 this page 上的窗口边缘,即当向上滚动以显示页面下方的内容时,容器 DIV 未显示:

#container {
  padding: 0;
  margin: 0;
  background-color: #292929;
  width: 1200px;
  margin: 0 auto;
  min-height: 100%;
}

谁能告诉我为什么这不起作用。

最佳答案

overflow: hidden 添加到:

#container {
    overflow: hidden; /* Right here */
    background-color: #292929;
    margin-bottom: 0;
    margin-left: auto;
    margin-right: auto;
    margin-top: 0;
    min-height: 100%;
    padding-bottom: 0;
    padding-left: 0;
    padding-right: 0;
    padding-top: 0;
    width: 1200px;
}

这将导致 #container 流过其中应为其提供计算高度的 float 元素的底部。另一种选择是执行 .clearfix .

关于css - 容器 DIV 未超出窗口的原始高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8482501/

相关文章:

html - 模拟怪癖模式表格呈现

javascript - 如何将完整图像放入 panelbody/card/div?

jquery - CSS height 和 inline height 属性不服从我

jquery - 固定高度,带有流畅的最大高度文本区域 - 自动溢出

html - 从 iFrame 中移除最小高度

css - 100% 高度或 100% 宽度

html - 如何在一段中设置行与行之间的边距?

html - 实现复制按钮功能

javascript - Font-Awesome 图标,带有 onclick 事件集

javascript - 可变高度元素上的 overflow hidden ?