css masonry image grid

How we can create a responsive grid layout for images using pure CSS. Solution: CSS Masonry Image Gird Layout, Responsive Grid Column.

Previously I have shared a Grid Menu Layout, but this time is for image gird. Basically, masonry stands for placing elements in optimal position based on available vertical space, like a mason fitting stones in a wall. Nowadays many image sharing websites use this type of layout. For example, you can see Pinterest.

Today you will learn to create responsive image grid columns. This is very easy stuff, whole design majorly based on 2-3 properties. One of my visitors asks me for creating this, that’s why posting this. You can use this on your website in the portfolio section, or any other place as you want.

So, Today I am sharing CSS Masonry Image Gird Layout. This is a pure CSS design, I have not used JS and there are very fewer lines of CSS code. The design is not based on flexbox, I have used the column layout. If you are a beginner then you can also understand this very easily.

If you are thinking now how the image grid actually is, then see the preview given below.

Preview Of Responsive Grid Column

See this video preview to getting an idea of how this grid looks like.

Live Demo

Now you can see this visually, also you can see it live by pressing the button given above. If you like this, then get the source code of its.

You May Also Like:

CSS Masonry Image Gird Layout Source Code

Before sharing source code, let’s talk about it. First I have created a divs with two class names container, and column. The container class is to giving width and placing the whole divs, and the column class is for managing image grids. Inside the div, I have placed some random images using Lorem Picsum.

Now in the CSS file, I gave max-width  for the whole container. I have used CSS column-* property for creating grid. The CSS multi-column layout allows creating column grids.I have used three column properties column-count , column-gapand column-width . Left all other basic things you will understand after getting the codes.

For creating this layout you have to create just 2 files, one for HTML and one for CSS. Follow the steps to creating this without any error.

index.html

Create an HTML file named ‘index.html‘ and put these codes given here below.

style.css

Now create a CSS file named ‘style.css‘ and put the codes given here.

That’s It. Now you have successfully created CSS Masonry Image Gird Layout, Responsive Grid Column. If you have any doubt or question comment down below.

Thanks For Visiting, Keep Visiting.

6 COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here