CSS Gradient Overlay Background
A see-through CSS gradient overlay laid over a colorful background, the same trick that tints a hero photo. Change the overlay colors, angle and strength live.
.bg-gradient-overlay {
--o1: #880088;
--o2: #222564;
--angle: 180deg;
--opacity: 70%;
--bg: #167364;
--c1: #f6c380;
--c2: #8fc188;
background-color: var(--bg);
background-image:
linear-gradient(var(--angle), color-mix(in srgb, var(--o1) var(--opacity), transparent), color-mix(in srgb, var(--o2) var(--opacity), transparent)),
radial-gradient(circle at 25% 30%, var(--c1) 0, transparent 45%),
radial-gradient(ellipse 80% 60% at 80% 75%, var(--c2) 0, transparent 60%);
}<div class="
[--o1:#880088]
[--o2:#222564]
[--angle:180deg]
[--opacity:70%]
[--bg:#167364]
[--c1:#f6c380]
[--c2:#8fc188]
[background-color:var(--bg)]
[background-image:linear-gradient(var(--angle),_color-mix(in_srgb,_var(--o1)_var(--opacity),_transparent),_color-mix(in_srgb,_var(--o2)_var(--opacity),_transparent)),_radial-gradient(circle_at_25%_30%,_var(--c1)_0,_transparent_45%),_radial-gradient(ellipse_80%_60%_at_80%_75%,_var(--c2)_0,_transparent_60%)]
"></div><!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Gradient Overlay — CSS background</title>
<style>
html, body { height: 100%; margin: 0; }
.bg-gradient-overlay {
--o1: #880088;
--o2: #222564;
--angle: 180deg;
--opacity: 70%;
--bg: #167364;
--c1: #f6c380;
--c2: #8fc188;
background-color: var(--bg);
background-image:
linear-gradient(var(--angle), color-mix(in srgb, var(--o1) var(--opacity), transparent), color-mix(in srgb, var(--o2) var(--opacity), transparent)),
radial-gradient(circle at 25% 30%, var(--c1) 0, transparent 45%),
radial-gradient(ellipse 80% 60% at 80% 75%, var(--c2) 0, transparent 60%);
}
</style>
</head>
<body class="bg-gradient-overlay"></body>
</html>Save the pattern as an image, with your current colors and settings.
How this gradient overlay works
A gradient overlay is a see-through gradient painted on top of something else. Here the top layer is one linear-gradient() that runs from --o1 to --o2, and each color is mixed with transparent through color-mix() so you can see through it.
The layers under it are a stand-in for a photo: a teal base with two soft glows. The overlay tints them purple at the top and deep navy at the bottom.
--opacity sets how much of the overlay shows. At 0% you see the base untouched. At 100% the overlay covers it completely. Around 60–75% is the usual range for keeping white text readable. --angle turns the overlay: 180deg runs top to bottom, 90deg left to right.
To put the overlay on your own photo, keep the first linear-gradient line and replace the two glow layers with your image. Use it on hero banners, cards with text over pictures, and dark section headers.