I use mainly Bootstrap, but in this case nor pure CSS nor Bootstrap could make the case. I have an HTML like this:
#filling{
display: flex;
flex-direction: column;
overflow-y: scroll;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<div>
<div class="container">
<div class="row align-items-center mt-3">
<div class="col-6 text-center">
<img width="150" height="150" src="img/user-placeholder.svg">
<p class="mt-2 mb-0">pholder</p>
</div>
<div class="col-6">
<div class="mb-2">
<div class="row">
<div class="col-6 text-center">pholder</div>
<div class="col-6 text-center">pholder</div>
</div>
<div class="row">
<div class="col-6 text-center">Friends</div>
<div class="col-6 text-center">Posts</div>
</div>
</div>
<butto class="btn btn-transparent mt-2">Click</button>
</div>
</div>
<br>
<p class="text-center m-0">Contents</p>
<hr class="mt-0 mb-2">
</div>
<div id="filling" class="text-center">
<div class="sample">
<img width="270" height="270" src="my_img.jpg">
<p>coding</p>
</div>
<div class="sample">
<img width="270" height="270" src="my_img.jpg">
<p>coding</p>
</div>
<div class="sample">
<img width="270" height="270" src="my_img.jpg">
<p>coding</p>
</div>
</div>
</div>
Now the issue is: the #filling div has to be populated dynamically and I want it to behave like ListView in Android programming. I must be able to scroll it. Therefore I added some CSS:
#filling{
display: flex;
flex-direction: column;
overflow-y: scroll;
}
But if I populate the div by appending children like those three .sample divs, the list grows vertically but the #filling div does too. In other words, its' forcing me to scroll the entire page rather than just the div.
I hope I have been clear, this sure will be marked as a duplicate of any flex question but I'd like to receive a working solution because other than fixing the height of the div, say, at 250px I cannot find a "responsive" way to do it.