Create a responsive Masonry Layout (Pinterest Style)
cr: Refokus & Lime knight
When you want to create a Pinterest-style layout, it becomes tough because when you make it using a grid, Webflow does this,
To achieve a masonry layout (Pinterest Style) in Webflow, there are 2 ways you go about: Use custom code or tweak it directly in Webflow. Let's look at both ways
Using custom code
Paste the below script in the “Before tag" field in the page settings
Now we’ll add 3 attributes to the div holding the collection list
a. Add <li-powerful>r-masonry-layout="1”<li-powerful> & set value to 1
b. Add <li-powerful>r-masonry-column-min="500”<li-powerful> & set value to 250
c. Add <li-powerful>r-masonry-gap="10”<li-powerful> & set value to 40
Hit publish and test!
Tweak in Webflow
We’ll not be using Flexbox or grid to achieve this. We’ll use text columns
- Leave the collection list as <li-powerful>display: block;<li-powerful>
- Set the number of columns you want (under Typography > More type options)
- Set the collection item to <li-powerful>display: inline-block;<li-powerful> to stop it from cutting the card in half when it reaches the bottom
- Set the horizontal gap using the column-gap property on the collection list (it's in the 3 dots menu next to columns)
- Set the vertical gap with margin-bottom on your collection items
And that's it! You achieved a Pinterest style layout directly on Webflow! Perfect for displaying a image library, blog sections or anything creative that you're thinking of
Webflow - Code to the Rescue
The Webflow Library for custom code snippets that unlocks powerful possibilities in Webflow. Includes hand-picked and tested custom code that you can use in Webflow Projects.
Need further help?
Need further help in understanding the resources or how to implement them? Feel free to reach out
About Ali Saeed
Ali Saeed is a Kuwait-based web designer and Webflow developer who has been working as a graphic designer for 4 years, building social brands, company profiles, and presentations. He recently jumped into web design and development. As a web designer, Ali focuses on clarity in design layout and messaging strategy. In his free time, he loves to help the web community, solve problems, and build resources for web designers who want to optimize their websites using Webflow.
Send an email if you'd like to collaborate :)
View his portfolio website