CSS Sunburst Background

A sunburst background in pure CSS: conic-gradient rays radiating from a soft glowing center. Set ray width, center and colors live, then copy the code.

#f09f33
#f6c380
#fbe7cc
18
50%
60%
50%
50%
.bg-sunburst {
  --bg: #f09f33;
  --c1: #f6c380;
  --c2: #fbe7cc;
  --rays: 18;
  --opacity: 50%;
  --glow: 60%;
  --x: 50%;
  --y: 50%;
  --ray: calc(180deg / var(--rays));
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at var(--x) var(--y), var(--c2) 0, transparent var(--glow)),
    repeating-conic-gradient(from 0deg at var(--x) var(--y), color-mix(in srgb, var(--c1) var(--opacity), transparent) 0 var(--ray), transparent 0 calc(var(--ray) * 2));
}
<div class="
  [--bg:#f09f33]
  [--c1:#f6c380]
  [--c2:#fbe7cc]
  [--rays:18]
  [--opacity:50%]
  [--glow:60%]
  [--x:50%]
  [--y:50%]
  [--ray:calc(180deg_/_var(--rays))]
  [background-color:var(--bg)]
  [background-image:radial-gradient(circle_at_var(--x)_var(--y),_var(--c2)_0,_transparent_var(--glow)),_repeating-conic-gradient(from_0deg_at_var(--x)_var(--y),_color-mix(in_srgb,_var(--c1)_var(--opacity),_transparent)_0_var(--ray),_transparent_0_calc(var(--ray)_*_2))]
"></div>
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Sunburst Gradient — CSS background</title>
  <style>
    html, body { height: 100%; margin: 0; }
    .bg-sunburst {
      --bg: #f09f33;
      --c1: #f6c380;
      --c2: #fbe7cc;
      --rays: 18;
      --opacity: 50%;
      --glow: 60%;
      --x: 50%;
      --y: 50%;
      --ray: calc(180deg / var(--rays));
      background-color: var(--bg);
      background-image:
        radial-gradient(circle at var(--x) var(--y), var(--c2) 0, transparent var(--glow)),
        repeating-conic-gradient(from 0deg at var(--x) var(--y), color-mix(in srgb, var(--c1) var(--opacity), transparent) 0 var(--ray), transparent 0 calc(var(--ray) * 2));
    }
  </style>
</head>
<body class="bg-sunburst"></body>
</html>

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

How this sunburst gradient works

The rays come from repeating-conic-gradient(), which sweeps around a center point like a clock hand and loops one slice: --c1 for --ray degrees, then transparent for the same amount so --bg shows through. Hard stops keep each ray’s edge sharp.

--rays sets how many rays go around the circle, and --ray: calc(180deg / var(--rays)) works out the width, so the rays always fill the circle exactly. Few rays give bold retro stripes, many give a fine starburst.

On top, a radial-gradient() in the lightest color turns the point where the rays meet into a soft glowing sun. --glow sets where it fades out: 60% is a wide, soft sun, 100% washes over the whole background.

--opacity fades the rays into the base with color-mix(in srgb, var(--c1) var(--opacity), transparent). Around 30% they become a quiet texture behind text.

Both layers share the center at var(--x) var(--y). Put it near the bottom edge for a rising sun. Use it for sale banners, award sections, retro designs and comic-style headers.

All CSS background gradients →