I have an isotope grid with a non fixed width and I dont know how to center the items inside the isotope container.
.box{
width: 40px;
height: 40px;
background-color: #e74c3c;
margin: 0 auto;
}
that css fails to center the items. here is the link to the fiddle that illustrates my problem.
How can i make the red squares center inside the black box?
Easiest way is to use masonry:
var $container = $('#container');
// init
$container.isotope({
// options
itemSelector: '.box',
masonry: {
columnWidth: 40,
isFitWidth: true
}
});