I’m doing a fetch list that return random card sizes with 2 widths:
- Horizontal (Larger)
- Default (Horizontal / 2)
And I’m getting blank spaces in masonry columns:
I’m working with react-masonry-css and with this styles:
.masonry-grid {
display: flex;
gap: 1rem;
width: auto;
}
.masonry-grid_column {
background-clip: padding-box;
}
.masonry-grid_column > div {
margin-bottom: 30px;
}
I want to auto fill empty blank spaces with the next card if it fits inside the space and the next next card replace site of previous card.
2
Answers
It was so easy :'P, I only added to masonry-grid_column class
If you use Masonry component of
react-masonry-css
, you can usebreakpointCols
property.Just place cards in Masonry component, that way, you can see components placed in masonry mode without gaps.