A CSS-based background grid generator
Written by Stefan Judis
- Published at
- Updated at
- Reading time
- 1min
A month ago, I was searching for a CSS generator to create a CSS grid background for a blog post component. ๐
I knew creating this CSS effect wouldn't be too hard, but fiddling with CSS gradients is not my strong suit. Unfortunately, my Google foo failed me. And if your search terms include "CSS" and "grid" you'll get only tutorials to use and create "CSS grids". ๐คฆโโ๏ธ
The only solution was to tweak random Codepens, and I spent a good half an hour creating vertical and horizontal lines in CSS.
So! If you, dear reader, are on the hunt for a quick CSS background grid generator, you reached your final destination!
Here's my contribution to the internet. ๐
.background-grid {
background-image: linear-gradient(#1c7cbb 1.5px, transparent 1.5px, transparent calc(100% - 1.5px), #1c7cbb calc(100% - 1.5px)), linear-gradient(90deg, #1c7cbb 1.5px, transparent 1.5px, transparent calc(100% - 1.5px), #1c7cbb calc(100% - 1.5px));
background-size: 10% 10%;
border: 1.5px solid #1c7cbb;
}
If you enjoyed this article...
Join 5.5k readers and learn something new every week with Web Weekly.
Reply to this post and share your thoughts via good old email.