I've made this : http://codepen.io/Canapin/pen/NNwMeq
#a {
height: 150px;
border: 1px solid black;
display: flex;
flex-direction: column;
flex-wrap: wrap;
position: absolute;
}
.b {
background: yellow;
height: 50px;
border: 1px solid black;
width: 50px;
margin: 10px;
}
<div id="a">
<div class="b">1</div>
<div class="b">2</div>
<div class="b">3</div>
<div class="b">4</div>
<div class="b">5</div>
</div>
Is there any way to make the container having a flexible width according to its content, like an inline block ?
edit : this should be the expected result :