I have 5 child div inside a fixed parent div whose height varies based on device. I'm looking for any hack to hide the entire div if it cannot fit in the fixed parent div.
I've tried "overflow: hidden;" but it only crops the part that is overflowing and not the entire div
.fixed-div {
background: greenyellow;
height: calc(100vh - 10px);
width: 100px;
position: fixed;
overflow: hidden;
}
.child-div {
width: 60px;
height: 60px;
background: red;
margin: 20px auto;
}
<div class="container">
<div class="fixed-div">
<div class="child-div"></div>
<div class="child-div"></div>
<div class="child-div"></div>
<div class="child-div"></div>
<div class="child-div"></div>
<div class="child-div"></div>
<div class="child-div"></div>
</div>
</div>
Expected: If the height can accomudate only 2 child div then other 5 child div should not be displayed or cropped completely