You want to change the default column width to 1px,
$("#container").masonry({ columnWidth: 1, });
otherwise, the default is the width of the first element.
Next you must delete the fields
.box-item { margin: 0px; }
and it should work.
Here is a script of what I think you are looking for http://jsfiddle.net/xKjUv/38/
source share