CSS Edge Glow Gradient Background

An edge glow gradient in pure CSS: four see-through linear gradients fade in from each side, framing a pale center. Pick each edge color and the depth.

#f0dff0
#b560b5
#7585b7
#df878c
#ca75a1
45%
80%
.bg-edge-glow-gradient {
  --bg: #f0dff0;
  --c1: #b560b5;
  --c2: #7585b7;
  --c3: #df878c;
  --c4: #ca75a1;
  --depth: 45%;
  --opacity: 80%;
  background-color: var(--bg);
  background-image:
    linear-gradient(to bottom, color-mix(in srgb, var(--c1) var(--opacity), transparent), transparent var(--depth)),
    linear-gradient(to left, color-mix(in srgb, var(--c2) var(--opacity), transparent), transparent var(--depth)),
    linear-gradient(to top, color-mix(in srgb, var(--c3) var(--opacity), transparent), transparent var(--depth)),
    linear-gradient(to right, color-mix(in srgb, var(--c4) var(--opacity), transparent), transparent var(--depth));
}
<div class="
  [--bg:#f0dff0]
  [--c1:#b560b5]
  [--c2:#7585b7]
  [--c3:#df878c]
  [--c4:#ca75a1]
  [--depth:45%]
  [--opacity:80%]
  [background-color:var(--bg)]
  [background-image:linear-gradient(to_bottom,_color-mix(in_srgb,_var(--c1)_var(--opacity),_transparent),_transparent_var(--depth)),_linear-gradient(to_left,_color-mix(in_srgb,_var(--c2)_var(--opacity),_transparent),_transparent_var(--depth)),_linear-gradient(to_top,_color-mix(in_srgb,_var(--c3)_var(--opacity),_transparent),_transparent_var(--depth)),_linear-gradient(to_right,_color-mix(in_srgb,_var(--c4)_var(--opacity),_transparent),_transparent_var(--depth))]
"></div>
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Edge Glow Gradient — CSS background</title>
  <style>
    html, body { height: 100%; margin: 0; }
    .bg-edge-glow-gradient {
      --bg: #f0dff0;
      --c1: #b560b5;
      --c2: #7585b7;
      --c3: #df878c;
      --c4: #ca75a1;
      --depth: 45%;
      --opacity: 80%;
      background-color: var(--bg);
      background-image:
        linear-gradient(to bottom, color-mix(in srgb, var(--c1) var(--opacity), transparent), transparent var(--depth)),
        linear-gradient(to left, color-mix(in srgb, var(--c2) var(--opacity), transparent), transparent var(--depth)),
        linear-gradient(to top, color-mix(in srgb, var(--c3) var(--opacity), transparent), transparent var(--depth)),
        linear-gradient(to right, color-mix(in srgb, var(--c4) var(--opacity), transparent), transparent var(--depth));
    }
  </style>
</head>
<body class="bg-edge-glow-gradient"></body>
</html>

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

How this edge glow gradient works

This gradient frames the element with color. Four semi-transparent linear-gradient() layers each start at one edge and fade toward the middle: to bottom from the top edge, to left from the right, to top from the bottom and to right from the left.

Each layer begins with a color-mix() of its color at --opacity and fades to transparent by --depth. At 45% the glows reach just short of the center, so the pale base color stays clear there. That’s a good spot for a headline or a form.

In the corners two glows overlap and mix, so the default light purple, blue, pink and rose tints blend into new shades on their own. Unlike a radial vignette, the glow follows the shape of the element, so it works on wide banners and tall sidebars alike.

Lower --depth for a thin colored border, or raise it to wash the whole element. Use it behind signup forms, featured cards, quotes and call-to-action sections.

All CSS background gradients →