How I added this background Grid to my blog
how-to-add-background-grid-to-a-section
Rehan · Sat May 20 2023

Recently, I have been looking at Miro Website and I was amazed by their design, choice of fonts, colors everything was perfect, however, one thing that stood out for me was the background grid.

Soon, I saw this on some other site, and then another. I want to understand how they are doing it, one obvious answer is that they have one svg added to the background, with size: cover, but then I find out an even better way; Linear Gradient.

Linear Gradient, as the name suggests are a way to add gradients to your website. However, this is not the complete truth about linear gradient, as it turns out you can do all crazy and weird stuff with this property including adding these grids to your site.

Code

body {
  background-color: #282c35;
  background-image: linear-gradient(#ffc4a715, 0.1rem, transparent 0.1rem),
    linear-gradient(90deg, #ffc4a715 0.1rem, transparent 0.1rem);
  background-size: 3.5rem 3.5rem;
  color: #fefefe;
}

Its just these few lines and you will have a background grid to whatever section you want to add it to.

Code Explaination:

And that's it. You can play with these values, add different angles, multipe gradients to achieve all kind of different patterns here, so what are you waiting for, go ahead and create some beautiful patterns.

You can view it in action here at my blog