I've created CSS for a modal dialog, but I'm facing an issue. When the content exceeds the vertical space of the wrapper, the scrolling functionality doesn't work correctly.
Although I can scroll, it's limited and I can't reach the beginning of the content.
What am I doing incorrectly?
.fade {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.2);
overflow: scroll;
}
.content {
position: absolute;
top: 50%;
left: 50%;
margin-right: -50%;
transform: translate(-50%, -50%);
background: white;
width: 300px;
}
Some text
<div class="fade">
<div class="content">
Fist line<br>Text line<br>Text line<br>...
...Last line
</div>
</div>