以下是有问题的问题的示例:
http://dev.madebysabotage.com/playground/overlay.html
您会看到整个页面上有一个灰色的覆盖,但如果向下滚动,初始加载页面下面的内容不会有覆盖。
我有一个#overlay
分区,它似乎不能在滚动时保持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>
https://stackoverflow.com/questions/4648418
复制相似问题