CSS Faded Grid Background

A faded grid background in pure CSS: grid lines that fade out toward the edges, the popular SaaS hero look, with no mask or image. Set size and fade live.

#cc3f47
#df878c
40px
75%
.bg-faded-grid {
  --bg: #cc3f47;
  --fg: #df878c;
  --size: 40px;
  --fade: 75%;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse at 50% 50%, transparent 25%, var(--bg) var(--fade)),
    linear-gradient(var(--fg) 1px, transparent 1px),
    linear-gradient(90deg, var(--fg) 1px, transparent 1px);
  background-size: 100% 100%, var(--size) var(--size), var(--size) var(--size);
  background-position: 0 0, 50% 50%, 50% 50%;
}
<div class="
  [--bg:#cc3f47]
  [--fg:#df878c]
  [--size:40px]
  [--fade:75%]
  [background-color:var(--bg)]
  [background-image:radial-gradient(ellipse_at_50%_50%,_transparent_25%,_var(--bg)_var(--fade)),_linear-gradient(var(--fg)_1px,_transparent_1px),_linear-gradient(90deg,_var(--fg)_1px,_transparent_1px)]
  [background-size:100%_100%,_var(--size)_var(--size),_var(--size)_var(--size)]
  [background-position:0_0,_50%_50%,_50%_50%]
"></div>
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Faded Grid — CSS background</title>
  <style>
    html, body { height: 100%; margin: 0; }
    .bg-faded-grid {
      --bg: #cc3f47;
      --fg: #df878c;
      --size: 40px;
      --fade: 75%;
      background-color: var(--bg);
      background-image:
        radial-gradient(ellipse at 50% 50%, transparent 25%, var(--bg) var(--fade)),
        linear-gradient(var(--fg) 1px, transparent 1px),
        linear-gradient(90deg, var(--fg) 1px, transparent 1px);
      background-size: 100% 100%, var(--size) var(--size), var(--size) var(--size);
      background-position: 0 0, 50% 50%, 50% 50%;
    }
  </style>
</head>
<body class="bg-faded-grid"></body>
</html>

Save the pattern as an image, with your current colors and settings.

Faded Grid in other colors

Click a color to try it in the preview above, then copy the code.

Browse by color: Red · Orange · Yellow · Green · Teal · Blue · Purple · Pink

How the faded grid pattern works

The faded grid is the background behind many SaaS landing pages: a grid that’s clear in the middle and melts into the page color at the edges. Most versions use mask-image. This one uses only backgrounds, so it pastes anywhere.

The bottom two linear-gradient() layers draw an ordinary 1px grid every --size pixels. background-position: 50% 50% centers the grid, so the middle of the element always lands on a crossing and the fade looks even.

The top layer does the fading. It’s a radial-gradient() ellipse that is transparent up to 25% of the way out, then blends into --bg by --fade. Because it paints the same color as the background, the lines seem to fade away. A lower --fade gives a small, tight spotlight. A higher one keeps more of the grid.

Use this CSS faded grid behind hero headlines, product screenshots, developer tool pages and dark-mode landing pages.