CssMasonry Demo

by Vahid Taghizadeh. available on Github

If you have seen pinterest, they has a multi-column interface to display the pins and those pins arrange nicely even if they are not of the same height.

they has a multi-column interface

They do it by using javascript to calculate the height of each pin and then positioning them absolutely.

Achieving the same with CSS can be done in two ways:

Using Floats: Floats can be used but only if all the pins have same height otherwise there will be gaps left all over.

Using CSS3 Columns: This is what I used here. It is explained in detail below.

Using Floats: Floats can be used but only if all the pins have same height otherwise there will be gaps left all over.

Achieving the same with CSS can be done in two ways:

If you have seen pinterest, they has a multi-column interface to display the pins and those pins arrange nicely even if they are not of the same height.

they has a multi-column interface

They do it by using javascript to calculate the height of each pin and then positioning them absolutely.