I have a dynamic-ish layout with columns, where the number of columns depends on the window width.
Using the image as an example, I have content boxes, which the user can collapse. If the screen was wide enough there would be 3 columns.
Now having a smaller window there's only 2 columns, but when the top left box is collapsed, the box beneath doesn't follow upwards.
I've tried using the column-count CSS propery, but can't make it work. In the specific examples if I have column count 2 it puts 2 boxes in the right column instead of the left.
My example CSS:
#content{
width:100%;;
height:100%;
display:inline-block;
}
#content div{
border-color:black;
border-style:solid;
border-width:2px;
display:inline-block;
width:300px;
vertical-align:top;
}
#box1{
height:50px;
}
#box2{
height:100px;
}
#box3{
height:30px;
}
Here's a simple jsfiddle of how I'm trying to do it.

Are there any CSS properties of html element structures that makes this possible. So far the only solutions i can find either needs me to have a fixed number of columns, or a fixed height on content boxes.
EDIT: In my search for an answer i've come across shapeshifter, which seems to be able to fix my issue, but by using absolute position and then calculate the offset to other element. I'm still very interested in a cleaner css way of creating a dynamic x-column layout, with variable content-box-sizes(collapsable), where elements align topside to the closest element in their column.