I have a container with a fixed height and display: flex. I want the children to fit in the column first by setting -webkit-flex-flow: column wrap;.
http://jsfiddle.net/wNtqF/1/
Can someone explain to me how chrome calculates the resulting width of a div container (div with a green border) and why it leaves so much free space to the right of each red element. I want the container to have a width to fit all children, with no extra empty space.
If this is not possible with pure css, can you provide me an alternative for this?
I am using chrome v 29.0.1547.76
Code to play:
<!DOCTYPE html>
<html>
<head>
<style>
.flex-container {
position: fixed;
height: 90%;
padding: 0;
margin: 0;
list-style: none;
border: 6px solid green;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-flex-flow: column wrap;
justify-content: flex-start
align-content: flex-start;
align-items: flex-start
}
body {
margin: 0;
padding: 0;
}
.flex-item {
background: tomato;
padding: 5px;
width: 100px;
height: 100px;
margin-top: 10px;
line-height: 150px;
color: white;
font-weight: bold;
font-size: 3em;
text-align: center;
}
</style>
</head>
<body>
<ul class="flex-container">
<li class="flex-item">1</li>
<li class="flex-item">2</li>
<li class="flex-item">3</li>
<li class="flex-item">4</li>
<li class="flex-item">5</li>
<li class="flex-item">6</li>
</ul>
</body>