私は非常に簡単なことをしようとしています。
私は、スクロールしてdiv
を持っている、と私は、オーバーレイdiv要素がスクロール領域含むすべての高さ、をカバーしますたいです。 min-height:100%
(this questionのような)を試しましたが、機能しません。ここでCSS - オーバーレイdivの高さ:スクロール領域を含む100%が機能していません
は一例でありhttps://jsfiddle.net/svfukxjd/2/
.main {
height: 300px;
width: 150px;
background: red;
overflow: auto;
position: relative;
}
.cover {
position: absolute;
height: 100%;
width: 100%;
top: 0;
bottom: 0;
background: green;
opacity: 0.5;
}
<div class="main">
<div>
Test
<br>Test
<br>Test
<br>Test
<br>Test
<br>Test
<br>Test
<br>Test
<br>Test
<br>Test
<br>Test
<br>Test
<br>Test
<br>Test
<br>Test
<br>Test
<br>Test
<br>Test
<br>Test
<br>Test
<br>Test
</div>
<div class="cover">
</div>
</div>