I want to size an overlay element to fill a scrollable parent element, without changing the parent element's attributes like display or position.
#scrollable {
width: 300px;
height: 100px;
overflow: auto;
background-color: rgba(0, 0, 255, 0.1);
}
#overlay {
width: 100%;
height: 100%;
background-color: rgba(255, 0, 0, 0.1);
position: absolute;
left: 0;
top: 0;
pointer-events: none;
}
<div id="scrollable">
<div contenteditable=true>
<p>Editable with parent with scrolling</p>
<p><br></p>
<p><br></p>
<p><br></p>
<p><br></p>
<p><br></p>
</div>
<div id="overlay">
</div>
</div>
https://jsfiddle.net/3d1npx0L/
This is similar to How to overlay one div over another div
except I want to achieve this without changing the parent/contain CSS.