CSS Only Sass Masonry Mixin

Supports gap indication in

*Percent gaps are not supported by css columns e.g. columns-gap: 3% .
The mixin will simulate that behaviour for you.

Some mixins used from bourbon.io

View project on github

How to

your-masonry-container {
    @include masonry(3, 2%, "> *");
}

Each variable is optional. Defaults are shown above.

Note

If you use percentages for columns gaps, it's recommended to not style the direct child elements of your-masonry-container and wrap the content inside with an additional element and style these elements like in this example.


Content 1

Content 2

Content 3

Content 4

Content 5

Content 6

Content 7

Content 8

Content 9

Content 10

Content 11

Content 12

Content 13

Content 14

Content 15

Content 16

Content 17

Content 18

Content 19

Content 20

Content 21

Content 22

Content 23

Content 24

Content 25