CSS Hourglass Linear Gradient Background

A see-through conic hourglass layered over a linear gradient in pure CSS. Pick the colors, set the linear angle, and change the hourglass width and spin.

#a8cbc5
#167364
#195654
90deg
70%
90deg
0deg
.bg-hourglass-linear-gradient {
  --bg: #167364;
  --c1: #a8cbc5;
  --c2: #195654;
  --opacity: 70%;
  --wedge: 90deg;
  --spin: 0deg;
  --angle: 90deg;
  background-color: var(--bg);
  background-image:
    conic-gradient(from var(--spin), color-mix(in srgb, var(--c2) var(--opacity), transparent), transparent var(--wedge) calc(180deg - var(--wedge)), color-mix(in srgb, var(--c2) var(--opacity), transparent) 180deg, transparent calc(180deg + var(--wedge)) calc(360deg - var(--wedge)), color-mix(in srgb, var(--c2) var(--opacity), transparent)),
    linear-gradient(var(--angle), var(--c1), var(--bg));
}
<div class="
  [--bg:#167364]
  [--c1:#a8cbc5]
  [--c2:#195654]
  [--opacity:70%]
  [--wedge:90deg]
  [--spin:0deg]
  [--angle:90deg]
  [background-color:var(--bg)]
  [background-image:conic-gradient(from_var(--spin),_color-mix(in_srgb,_var(--c2)_var(--opacity),_transparent),_transparent_var(--wedge)_calc(180deg_-_var(--wedge)),_color-mix(in_srgb,_var(--c2)_var(--opacity),_transparent)_180deg,_transparent_calc(180deg_+_var(--wedge))_calc(360deg_-_var(--wedge)),_color-mix(in_srgb,_var(--c2)_var(--opacity),_transparent)),_linear-gradient(var(--angle),_var(--c1),_var(--bg))]
"></div>
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Hourglass Linear Gradient — CSS background</title>
  <style>
    html, body { height: 100%; margin: 0; }
    .bg-hourglass-linear-gradient {
      --bg: #167364;
      --c1: #a8cbc5;
      --c2: #195654;
      --opacity: 70%;
      --wedge: 90deg;
      --spin: 0deg;
      --angle: 90deg;
      background-color: var(--bg);
      background-image:
        conic-gradient(from var(--spin), color-mix(in srgb, var(--c2) var(--opacity), transparent), transparent var(--wedge) calc(180deg - var(--wedge)), color-mix(in srgb, var(--c2) var(--opacity), transparent) 180deg, transparent calc(180deg + var(--wedge)) calc(360deg - var(--wedge)), color-mix(in srgb, var(--c2) var(--opacity), transparent)),
        linear-gradient(var(--angle), var(--c1), var(--bg));
    }
  </style>
</head>
<body class="bg-hourglass-linear-gradient"></body>
</html>

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

How this hourglass linear gradient works

This gradient lays a single-color conic-gradient() over a linear-gradient(). The linear layer runs from --c1 to --bg at --angle, so by default it goes from light teal on the left to teal on the right, with a deep teal hourglass. All three are shades of one palette color.

The conic layer is solid at the top and bottom and transparent at the middle left and middle right: the color at 0°, transparent at --wedge, the color at 180°, transparent at 180° plus --wedge, and the color again at 360°. That makes a soft hourglass that meets in the center. It uses a color-mix() with transparent at --opacity, so the linear gradient shows through.

Because the hourglass is symmetric and the linear gradient isn’t, the two halves pick up different tints. Turn --angle to 0° and the stripe runs top to bottom instead. --wedge narrows the hourglass and --spin rotates it. Use it for banners, app headers and section dividers.

All CSS background gradients →