Question

I am trying to add pinterest-like item style to my gallery, but getting huge gaps between my thumbnails. Found several similar questions on SO, but none of them helped with my situation, unfortunately.

script

$('#container').masonry({
    itemSelector: '.container',
    columnWidth : 100 
});

gallery

<div id="container">
    <div class="item">...</div>
</div>

styles

.item {
  width: 122px;  
  margin: 5px;
  float: left;
  background-color: gray;
}

http://jsfiddle.net/D7QQU/44/

Thanks in advance

Was it helpful?

Solution

Here's a working example, Have a look and let me know if this is what you're after.

http://jsfiddle.net/D7QQU/47/

$('#container').masonry({
    itemSelector: '.item',
    columnWidth : 100,
    gutter: 10
});

#container .item {
    background-color: gray;
    width: 100px;
    float: left;
    margin-bottom: 10px;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top