Are you looking to create a visually stunning masonry layout structure that uses a CSS grid or Flexbox? Your search ends here! In this collection, we are showcasing 40+ HTML and CSS masonry layout code examples that create visually appealing and eye-catching web projects. We’ve sourced these masonry layouts from GitHub, Codepen, and various other sources, automatically adjusting each item in columns best for showing images, text, and artwork in an aesthetically pleasing, space-efficient way.

We offer a diverse range of masonry code snippets, from basic grid layouts to more intricate flexbox layouts, which enhance the dynamic arrangement of items on a web page. Whether you’re building a portfolio website, e-commerce site, social media platform, or blog site, you can arrange any type of content using these captivating masonry grids.

Our curated compilation of CSS masonry layouts is easy to customise, improves aesthetics, and enhances the user experience, giving your site a unique and stylish look. Let’s checkout our collection today and make your website stand out with stunning, interactive 100% free CSS masonry layout designs.

1. CSS Grid L+L – Finished


Author: Joseph Shambrook
Source:  Code / Demo
Created on: SEPTEMBER 28, 2018
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML, CSS

2. Pure CSS Masonry Gallery with Flexbox


Author: digistate
Source:  Code / Demo
Created on: MAY 25, 2016
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML, CSS

3. Photo Gallery


Author: Russ Perry
Source:  Code / Demo
Created on: JANUARY 22, 2020
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML, CSS(SCSS)

4. Masonry layout js


Author: Crianbluff
Source:  Code / Demo
Created on: SEPTEMBER 9, 2018
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML, CSS(SCSS), JavaScript

5. CSS Grid: Columns (Pure CSS Masonry Layout)


Author: Lasse Stilvang
Source:  Code / Demo
Created on: MARCH 20, 2018
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML, CSS

6. Easy Horizontal Masonry Effect with CSS Grid


Author: Andy Barefoot
Source:  Code / Demo
Created on: MAY 7, 2018
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML, CSS

7. Masonry Grid Animation & Fancybox


Author: Ungmo Lee
Source:  Code / Demo
Created on: NOVEMBER 28, 2016
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML, CSS, JavaScript

8. Easiest Masonry grid layout Tutorial.


Author: CSSFTW
Source:  Code / Demo
Created on: AUGUST 23, 2017
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML, CSS

9. CSS Grid: Responsive Masonry Layout


Author: Saief Al Emon
Source:  Code / Demo
Created on: MAY 4, 2020
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML, CSS

10. Responsive Pure CSS Masonry Layout – Column Count


Author: Stephanie
Source:  Code / Demo
Created on: MARCH 17, 2017
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML, CSS

11. Masonry Layout Demo 1


Author: Jen Simmons
Source:  Code / Demo
Created on: MAY 1, 2020
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML, CSS

12. Masonary Wall


Author: KEYUR PARALKAR
Source:  Code / Demo
Created on: AUGUST 31, 2016
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML, CSS(SCSS), JavaScript

13. Masonry Grid Gallery – CSS Practice


Author: Kate Hummer
Source:  Code / Demo
Created on: MARCH 9, 2017
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML, CSS

14. Masonry Layout JS Vanilla


Author: Alberto Mateo
Source:  Code / Demo
Created on: JULY 2, 2019
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML, CSS, JavaScript

15. Easy CSS Masonry Layout with Left-To-Right Content Flow

Author: Jesse Korzan
Source:  Code / Demo
Created on: APRIL 7, 2018
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML, CSS, JavaScript

16. Bootstrap 4 Masonry Layout


Author: Techiediaries
Source:  Code / Demo
Created on: FEBRUARY 15, 2018
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML, CSS

17. Masonry Dynamic Column Flexbox (CSS Only)


Author: Chris Weissenberger
Source:  Code / Demo
Created on: NOVEMBER 16, 2019
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML, CSS(SCSS), JavaScript

18. Masonry Layout


Author: Said El Bakkali
Source:  Code / Demo
Created on: JANUARY 19, 2019
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML, CSS(SCSS), JavaScript

19. CSS Only Masonry Layout (No CSS Grid)


Author: Kreig Durham
Source:  Code / Demo
Created on: MAY 23, 2018
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML, CSS(SCSS)

20. Masonry Layout with filtering


Author: Daniel Gonzalez
Source:  Code / Demo
Created on: OCTOBER 12, 2017
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML, CSS(SCSS), JavaScript

21. Masonry with Flexbox + JS


Author: Chris Coyier
Links:  Code / Demo
Created on: DECEMBER 18, 2018
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML(Slim), CSS(SCSS), JavaScript

22. Masonry Layout – CSS Grid


Author: Steven Roberts
Source:  Code / Demo
Created on: NOVEMBER 15, 2017
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML, CSS(SCSS), JavaScript

23. Infinite Scroll v4 – Masonry, vanilla JS


Author: Dave DeSandro
Source:  Code / Demo
Created on: JUNE 20, 2017
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML, CSS, JavaScript

24. CSS Masonry Effect


Author: Luca
Source:  Code / Demo
Created on: NOVEMBER 17, 2019
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML, CSS(SCSS)

25. Masonary Wall


Author: KEYUR PARALKAR
Source:  Code / Demo
Created on: AUGUST 31, 2016
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML, CSS(SCSS), JavaScript

26. Pinterest like grid (Masonry Layout) Pure CSS


Author:  Urias
Source:  Code / Demo
Created on: JANUARY 13, 2015
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML, CSS, JavaScript

27. Testimonials/Reviews Using Masonry


Author: Tyler Berry
Source:  Code / Demo
Created on: MARCH 19, 2015
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML, CSS

28. CSS Column masonry layout


Author: Trevor Eyre
Source:  Code / Demo
Created on: NOVEMBER 10, 2017
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML, CSS(SCSS)

29. Flexbox Masonry — Horizontal

Author:  Rahul
Source:  Code / Demo
Created on: MARCH 8, 2019
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML, CSS

30. Masonry-Like CSS Grid


Author: Justin Goff
Source:  Code / Demo
Created on: MARCH 25, 2020
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML, CSS, JavaScript

31. Masonry – columnWidth


Author: Dave DeSandro
Source:  Code / Demo
Created on: JUNE 12, 2013
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML, CSS, JavaScript

32. Masonry/Packery/Isotope layout


Author: englishextra
Source:  Code / Demo
Created on: JANUARY 7, 2017
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML, CSS, JavaScript

33. Only CSS Masonry


Author: Omar Trujillo
Source:  Code / Demo
Created on: OCTOBER 29, 2019
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML, CSS

34. Creating a Responsive Pure CSS Masonry Layout

Author: Rahul
Source:  Code / Demo
Created on: MARCH 28, 2019
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML, CSS

35. Flexbox Masonry


Author: lukejacksonn
Source:  Code / Demo
Created on: FEBRUARY 18, 2016
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML, CSS(SCSS), JavaScript(Babel)

36. CSS Grid Masonry (Step 10)


Author: Andy Barefoot
Source:  Code / Demo
Created on: SEPTEMBER 10, 2017
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML, CSS, JavaScript

37. Masonry


Author: RenGM
Source:  Code / Demo
Created on: FEBRUARY 9, 2015
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML, CSS

38. Simple Masonry Layout With Flexbox


Author: Dudley Storey
Source:  Code / Demo
Created on: MARCH 1, 2014
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML, CSS

39. Bootstrap Masonry Grid Template


Author: Artūrs Deņisovs
Source:  Code / Demo
Created on: JUNE 21, 2017
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML, CSS

40. Masonry Layout with CSS Grids


Author: Madalena
Source:  Code / Demo
Created on: MARCH 1, 2020
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML, CSS

41. Responsive pseudo Masonry in CSS columns


Author: Olivier C
Source:  Code / Demo
Created on: NOVEMBER 26, 2016
Compatible browsers: Chrome, Firefox, Opera, Edge, Brave
Made with: HTML(Pug), CSS(Stylus)