My modal contains a scrollable list with many items that have absolute positioned elements causing overflow within the modal.
How can I ensure that the absolute positioned elements are visible in this scenario?
.modal {
width: 300px;
border: 1px solid red;
margin: 0 auto;
}
.list {
width: 100%;
max-height: 500px;
margin: 0;
padding: 0;
overflow-y: scroll;
}
.content {
list-style: none;
height: 200px;
border: 1px solid rgb(46, 20, 20);
position: relative;
}
.overflow {
position: absolute;
left: -50px;
top: 25%;
border: 1px solid green;
height: 100px;
width: 100px;
}
<div class="modal">
<ul class="list">
<li class="content">
Content area
<div class="overflow">overflow</div>
</li>
<li class="content">
Content area
<div class="overflow">overflow</div>
</li>
<li class="content">
Content area
<div class="overflow">overflow</div>
</li>
<li class="content">
Content area
<div class="overflow">overflow</div>
</li>
</ul>
</div>