0

I have elements structured roughly like this: http://jsfiddle.net/zyySd/

Is there any way to achieve this: http://jsfiddle.net/zyySd/1/

without resorting to taking the elements out of the document's flow and hardcoding absolute positioning values? In the case that I don't know what the dimensions of the divs are, I would not be able to use absolute position as I did in the second JSFiddle.

mburke13
  • 350
  • 2
  • 6
  • 22

1 Answers1

1

CSS can't really do it. You need JavaScript.

jQuery Masonry is good: http://masonry.desandro.com/

There's also a no-framework version, Vanilla Masonry: http://vanilla-masonry.desandro.com/

Community
  • 1
  • 1
thirtydot
  • 224,678
  • 48
  • 389
  • 349