The height of my parent div is fixed and i need to add multiple child div which could be scrolled through due to overflow. I have used flex layout to arrange child div in one column.
The issue i am facing is that, the child div(s) are resizing themselves to adjust inside the parent div instead of maintaing their height and introducing scroll bar.
I have tried resize: none;
, but that didn't worked.
Code is as follows :
Html code :
<div id="parent-box">
<div class="child-box"></div>
<div class="child-box"></div>
<div class="child-box"></div>
<div class="child-box"></div>
<div class="child-box"></div>
</div>
Css code :
#parent-box{
height: 300px;
width: 500px;
display: flex;
flex-direction: column;
overflow: auto;
}
.child-box {
height: 100px;
margin: 10px;
resize: none;
}
I have tried finding the solution but didn't got one, since i didn't knew exactly what to search. Please share any article or documentation related to this concept. Thank you.