Skip to content
Advertisement

How can i get the pinterest-like layout with tailwind and react?

i’m trying to get a pinterest-like layout but i cannot achieve it,

Here is what i want :

and here is what i get :

Here is the div of the card :

JavaScript
JavaScript

and here is the div that map all the card :

JavaScript
JavaScript

i tried flex-wrap, i tried grid but it doesn’t work, where is my error please ?

Advertisement

Answer

This type of layout is called Masonry. It is currently implemented in firefox under experimental options. There is also an npm package for positioning your elements in such a grid.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement