【发布时间】:2011-01-10 15:33:48
【问题描述】:
以下是相关问题的示例:
http://dev.madebysabotage.com/playground/overlay.html
您会看到整个页面上有一个灰色叠加层,但如果您向下滚动,初始加载页面下方的内容没有叠加层。
我有一个#overlay div,它似乎在滚动过程中没有保持 100% 的高度,所以试图弄清楚如何将其拉下来。
这是完整的来源:
html {
height: 100%;
min-height: 100%;
}
body {
height: 100%;
min-height: 100%;
font-family: Georgia, sans-serif;
}
#overlay {
background: rgba(0, 0, 0, 0.4);
width: 100%;
height: 100%;
min-height: 100%;
position: absolute;
top: 0;
left: 0;
z-index: 10000;
}
header,
section,
footer {
width: 800px;
margin: 0 auto 20px auto;
padding: 20px;
background: #ff0;
}
section {
min-height: 1500px;
}
<div id="overlay"></div>
<header>
<h1>Header</h1>
</header>
<section>
<p>Here's some sweet content</p>
</section>
<footer>
<p>Here's my footer</p>
</footer>
【问题讨论】:
-
谢谢!对于其他阅读者,问题已在上面的链接中修复。要重新创建它,请使用 Firebug 或类似工具从覆盖 id 中删除
position:fixed;:) -
3 年后我遇到了同样的问题 :) +1 提问