I have an absolute-positioned div with two children -- an absolute-positioned div and a static div which will scroll inside the parent. It looks like this:
<div class='frame'>
<div class='absolute-contents'>This should stay put.</div>
<div class='static-contents'>This should scroll under it.</div>
</div>
And here's the CSS:
.frame {
position: absolute;
top: 40px;
left: 40px;
right: 40px;
bottom: 40px;
overflow-y: scroll;
}
.absolute-contents {
position: absolute;
top: 40px;
left: 40px;
right: 40px;
bottom: 40px;
z-index: 9999;
opacity: .9;
padding: 40px;
}
.static-contents {
margin: 24px auto;
width: 400px;
height: 3000px;
padding: 40px;
}
I have the absolute child constrained to the edges of the parent, so why does it still scroll, and how can I make it stay put?
Example: https://codepen.io/anon/pen/wqZxXG