<div class="container">
<div class="item">item-1</div>
<div class="item item-list">
<div class="elem">elem-1</div>
<div class="elem">elem-2</div>
<div class="elem">elem-3elem-3-elem-1ele</div>
<div class="elem">elem-3-elem-1</div>
<div class="elem">elem-3-elem-2</div>
<div class="elem">elem-3-elem-3-elem-3-elem-1</div>
<div class="elem">elem-4-elem-1</div>
<div class="elem">elem-5</div>
</div>
<div class="item item-filler">item-2</div>
<div class="item">item-3</div>
</div>
<style>
.container {
width: 600px;
box-shadow: 0 0 0 2px, inset 0 0 0 1em white;
background: gray;
display: flex;
align-items: flex-start;
align-content: flex-start;
flex-wrap: wrap;
resize: both;
overflow: auto;
}
.container > * {
background: gray;
padding: 2em;
box-shadow: inset 0 0 0 1em white;
}
.item-list {
display: contents;
}
.item-filler {
flex: 1;
}
.container > * > * {
background: red;
padding: .8em;
margin: 1.2em;
}
</style>