I'm trying to do something very simple.
I have div
with scroll, and I want the overlay div will cover all the height, including the scroll area.
I've tried min-height:100%
(like in this question) but it's not working.
Here is an example 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>