I’m currently working on a design that requires multiple <DIV> elements sorted vertically but also keeping its ability to be responsive.
Examples:
Wider layout

Taller layout

I’ve used floats, inline-block display and even resorted to crudely putting it together with jQuery but all elements sort horizontally.
Looking around I can’t seem to find any others with the same issue or solutions so any assistance would be great.
If you’re not too concerned about cross-browser support (and just want to make it prettier in the compliant/up-to-date browsers), or are happy to use a JavaScript shim, of some kind, to enable support in other browsers, you could use
column-widthto define the width of the columns and then allow the browser to reflow those columns to accommodate the content:JS Fiddle demo.
Clearly I’ve used
liandulelements for the purposes of the demo, but this is directly transferable todivelements if you prefer. Simply style the parent/container in the same fashion as the aboveulelement, and style the child elements as you like.References: