CSS Sunset Gradient Background

A sunset gradient in pure CSS: a night-blue sky melting through purple, pink and orange to a golden horizon with a soft sun glow. Pick all six colors.

#222564
#880088
#aa2068
#de6f3d
#f09f33
#fbe7cc
85%
.bg-sunset-gradient {
  --c1: #222564;
  --c2: #880088;
  --c3: #aa2068;
  --c4: #de6f3d;
  --bg: #f09f33;
  --c5: #fbe7cc;
  --glow: 85%;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse var(--glow) calc(var(--glow) * 0.7) at 50% 100%, var(--c5) 0, transparent 70%),
    linear-gradient(var(--c1) 0%, var(--c2) 35%, var(--c3) 55%, var(--c4) 78%, var(--bg) 100%);
}
<div class="
  [--c1:#222564]
  [--c2:#880088]
  [--c3:#aa2068]
  [--c4:#de6f3d]
  [--bg:#f09f33]
  [--c5:#fbe7cc]
  [--glow:85%]
  [background-color:var(--bg)]
  [background-image:radial-gradient(ellipse_var(--glow)_calc(var(--glow)_*_0.7)_at_50%_100%,_var(--c5)_0,_transparent_70%),_linear-gradient(var(--c1)_0%,_var(--c2)_35%,_var(--c3)_55%,_var(--c4)_78%,_var(--bg)_100%)]
"></div>
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Sunset Gradient — CSS background</title>
  <style>
    html, body { height: 100%; margin: 0; }
    .bg-sunset-gradient {
      --c1: #222564;
      --c2: #880088;
      --c3: #aa2068;
      --c4: #de6f3d;
      --bg: #f09f33;
      --c5: #fbe7cc;
      --glow: 85%;
      background-color: var(--bg);
      background-image:
        radial-gradient(ellipse var(--glow) calc(var(--glow) * 0.7) at 50% 100%, var(--c5) 0, transparent 70%),
        linear-gradient(var(--c1) 0%, var(--c2) 35%, var(--c3) 55%, var(--c4) 78%, var(--bg) 100%);
    }
  </style>
</head>
<body class="bg-sunset-gradient"></body>
</html>

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

How this sunset gradient works

This sunset gradient is a sky in two layers. The bottom layer is a top-to-bottom linear-gradient() with five stops: deep navy at the top, then purple at 35%, pink at 55%, orange at 78% and golden yellow at the horizon. The stops crowd together toward the bottom, the way a real sky changes fastest near the horizon.

The top layer is the sun: a radial-gradient() ellipse sitting on the bottom edge (at 50% 100%). --glow sets its width, and its height is 0.7 times that, so the default 85% spreads most of the way across. It starts in the palest yellow and fades to transparent, so it glows instead of looking like a flat disc.

Every color comes from neighbors on the brand color wheel, so each band blends cleanly into the next. For a sunrise, use lighter colors at the top. To raise the sun, change its 100% to 85%.

Use it for travel and hospitality sites, music and event pages, summer campaigns and calm wellness designs.

All CSS background gradients →