Is it possible to "clear" element in a "display: flex" container?
I want to achieve something like this:
With floats, I could "clear" after each 5th element with proper media queries...
Using an element to break to a new flex row comes with an interesting effect: we can skip specifying the width of any item in our flex layout and rely completely on the line breaks to define the flow of our grid. This produces a layout with two vertically stacked full-width items (I've added a border to the .
For 3 items per row, add on the flex items: flex-basis: 33.333333% You can also use the flex 's shorthand like the following: flex: 0 0 33.333333% => which also means flex-basis: 33.333333% .
You can add flex-wrap: wrap;
to the container and set the width of the elements inside.
Then you should have the control to decide on which elements the floating will stop.
Demo: http://codepen.io/imohkay/pen/gpard
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With