0

Here is my HTML:

<div class="masonry-container">
    <div class="masonry-item">
        <!-- post thumbnail -->
        <a href="#">
            <img src="">
        </a>
        <!-- /post thumbnail -->
        <div class="masonry-body">
            <h3><a href="#" title="">Title</a></h3>

            Some text...
        </div>
    </div>
</div>

.masonry-container has no height specified whatsoever, but what happens is after some random height the last item overflows into the next column resulting in items to appear broken in the grid.

My CSS:

.masonry-container {
    width: 100%;
    columns: 3;
    column-gap: 20px;
    .masonry-item {
        margin: 10px;
        background: #fff;
        overflow: auto;
        img {
            max-width: 100%;
        }
        .masonry-body {
            padding: 30px;
            max-width: 100%;
            h3 {
                font-family: 'Playfair Display';
                font-weight: 700;
                font-size: 1.6em;
            }
        }
    }
}

screenshot

Paulie_D
  • 107,962
  • 13
  • 142
  • 161
Amir Rami
  • 375
  • 3
  • 13

0 Answers0