How to make native WordPress Gallery display as Masonry style?

Based on WordPress documentation, this creates a gallery with 3 columns:


Rather than downloading a plugin, is there any chance someone has managed to figure out some CSS to make the gallery images appear in Masonry format?

I’ve tried to add my own, but no cigar. The padding/margins are off.

Here’s what I had:

.gallery-template img {
    max-width: 100%;
    height: auto;
    border:none !important;
}

.gallery-item {
    max-width: 400px !important;
}

.gallery-caption {
    display:none;
}

The biggest thing would be to have them display as if it were inline-block which is what makes Masonry style so fluid.

Read more here: How to make native WordPress Gallery display as Masonry style?

Leave a Reply

Your email address will not be published. Required fields are marked *