Here is the demo (resize to see effects).
(Note: at this moment this demo doesn't work with Firefox 27 and below and Safari 7 and below - use Firefox 28+, Chrome 31+ , Opera 19 or IE11)
The issue is that when the wrapping div
grows and we drop into multi-line mode there is extra space generated between my individual article entries. Is there any way to force the articles to all pack to the top of the given "column"?
This is illustration of my question:
(source: sirmium.org)
Can this be accomplished with flexbox?
Existing code from JSFiddle:
HTML
<div class="section">
<div class="article">Someething A</div>
<div class="article">Something B</div>
<div class="article">Some content C</div>
<div class="article">Some content D</div>
<div class="article">Something E</div>
<div class="article">Some content</div>
<div class="article">Something F</div>
<div class="article">Some content G</div>
</div>
CSS
.section {
border :3px solid red;
width:100%;
display: flex;
flex-wrap: wrap;
align-items: flex-start;
}
.article {
width:300px;
border:2px solid green;
margin: 5px 5px 5px 5px;
flex-grow: 1;
}