Trying to set-up my flexbox
grid as simply as possible.
I want the flex-item
to be justify: space-around
at all times.
However, once it is time for a flex-item
to wrap to the next line, it should 'float left' so it can continue to align to the rest of the elements above.
Can't seem to get the right combination of flexbox
properties to do this:
.flex-container{
display:flex;
justify-content: space-around;
flex-wrap: wrap;
}
.flex-item{
flex: 0 0 200px;
height: 200px;
background: blue;
margin: 1em;
}
.flex-item:after{
content:'';
flex-grow: 1000000000;
}
<div class="flex-container">
<div class="flex-item"></div>
<div class="flex-item"></div>
<div class="flex-item"></div>
<div class="flex-item"></div>
<div class="flex-item"></div>
<div class="flex-item"></div>
</div>
Pretty standard layout behavior for a grid of products right?
Anyone got an idea how I can achieve this?
Maybe I am 'missing something' with how flexbox
is meant to be used, but I sadly had to revert to my old float
s and clear
s to get what I wanted for this layout.