I am seeking a solution to ensure that the children inside my scrollable div are only visible in their entirety.
HTML
<div id="container">
<div class="child"></div>
<div class="child"></div>
<div class="child"></div>
<div class="child"></div>
<div class="child"></div>
<div class="child"></div>
</div>
CSS
#container {
display:block;
overflow-y: scroll;
overflow-x: hidden;
height: 250px;
width: 150px;
}
.child {
background-color: red;
height: 100px;
width: 100px;
margin: 5px;
}
In this scenario, only two and a half red boxes will initially appear on the screen (the third box extends beyond the viewable area). I aim for the third (and subsequent) boxes to be shown only when they can be fully displayed by scrolling.