Let me start from a tiny example based on display:flex;
.
#container {
display: flex;
align-items: flex-start;
flex-wrap: wrap;
width: 150px;
}
.content {
border: 1px solid black;
display: inline-block;
padding: 5px;
}
<div id="container">
<div class="content">content</div>
<div class="content">content <br/> big</div>
<div class="content">content</div>
<div class="content">content</div>
<div class="content">content</div>
<div class="content">content</div>
<div class="content">content</div>
<div class="content">content</div>
</div>
As you can see here, when there is a difference between component height in one row, empty space will appear near smaller component.
It will not happen when using flex-direction: column;
but in this case height must be setted.
I want to make a grid of unlimited height, with 2 columns, and items height can be extended when user clicks on it (to see additional info).
I also tried display: grid;
(results was the same as with flex) and columns: 2
with presetted columns width.
With columns: 2
it almost worked, but sometimes when item height extends items from one column goes to another, which looks pretty bad.
So the question is there any way to do that kind of grid on pure css.
Easiest way I see is in using display: flex;
with flex-direction: column;
but with javascript calculated height for container.But I want to avoid using javascript for styling as much as I can.
Thank you for any advise!