masonry icon indicating copy to clipboard operation
masonry copied to clipboard

Layout error if grid container has border

Open bluerayyy opened this issue 6 years ago • 1 comments

Here is a CodePen and also a Stackoverflow threat to explain the problem I am having.

Simply put, it seems if the grid container has a border, the coresponding calculations to fit the items in masonry layout seem to be slightly off. I have accounted for the borders, margins and paddings of the container and the items within it, but the issue persists.

Thanks a lot!

bluerayyy avatar Jan 17 '20 16:01 bluerayyy

As a general comment you might want to apply border-box to all elements - recommend best practice - and not just for masonry.

* {
        box-sizing: border-box;
    }

I made that change in your codepen, and it did adjust the layout. Not sure if that is what you intend but it made a difference.

kitsguru avatar Jun 09 '20 18:06 kitsguru