I'm building an image portfolio site, and I need the images to stack depending on their variable size. This is what I have achieved with flexbox so far:
And this is where I'm trying to get!!
Does someone know how to make children stack this way on a flexbox display? I swear I can't find this particular structure anywhere on flexbox tutorials, though I've seen it several times on tumblr blog displays.
This is my code: http://jsfiddle.net/822h7ztd
.flexman {
width:100%;
padding: .2vw;
flex-flow: row wrap;
display: flex;
}
.flexman div {
background: red;
width: 100px;
height:50px;
margin: .2vw;
}
The best solution I've come up with is to set the services images to overflow: hidden and the staff images to nowrap, this prevents images from either gallery from overlapping with any other elements.
It can be changed by using the flex-direction property. To use flexbox, we have to set display: flex or inline-flex to flex-container. By default, the height and width of a flex-container are set to auto. But we can define a fixed amount to them.
Getting the child of a flex-item to fill height 100% Set position: absolute; on the child. You can then set width/height as required (100% in my sample).
For anyone who might have encountered this, seems like what you are looking for is called a Masonry layout, which can be achieved with flexbox this way:
http://thenewcode.com/844/Easy-Masonry-Layout-With-Flexbox
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