How to center a div inside masonry?

I searched EVERYWHERE and cannot find an answer for this.

How can I vertically and horizontally center a div in a layout? I basically want everything around this div to be created.

Any help would be great!

http://isotope.metafizzy.co/

+3
source share
2 answers

When you call the brickwork, you can use isFitWidth: trueand then set the marker: 0 auto in the container.

$container.masonry({
    columnWidth : 120,
    isFitWidth: true

});

See live here example: Center Freemasonry

+12
source

if it's just a div, you can try the user

margin: 0 auto; 

for horizontal centering.

to center vertically, you can try the following:

http://blog.themeforest.net/tutorials/vertical-centering-with-css/

+3

All Articles