2

In pinterest.com, the divs have variable length, yet there are no gaps between the rows. Is it possible to get this effect using an unordered list and css? Are they using any javascript to achieve that "compact" look? When I tried it, there is always a gap between two rows to accommodate the tallest div from the first row...

Diodeus - James MacFarlane
  • 112,730
  • 33
  • 157
  • 176
Prabhu
  • 12,995
  • 33
  • 127
  • 210

3 Answers3

4

If you use Firebug or Chrome's web inspector, you'll see that each of the .pin divs has an absolute position, which is presumably set with JavaScript.

David Wolever
  • 148,955
  • 89
  • 346
  • 502
4

It's done via jQuery Masonry available on github https://github.com/desandro/masonry

Francis Ouellet
  • 505
  • 4
  • 15
  • 1
    Just to clarify, Pinterest does not use Masonry (at least not last time I looked at their code), but Masonry will give you a similar result. – Michael Mior Oct 25 '12 at 18:05
1

There's a lot of jQuery Plugins that archive that.

I like "Isotope - An exquisite jQuery plugin for magical layouts"

http://isotope.metafizzy.co/