TL;DR
linear-gradient(), radial-gradient(), conic-gradient() (plus their repeating- variants), and of course - any image.background-color paints behind all images. Control paint boxes with background-clip and background-origin.position/size/repeat/blend-mode).Why this matters: layered CSS backgrounds let you ship rich visuals with no images, faster LCP, and crisp scaling on any DPI. Done right, it’s great for SEO and performance: fewer image downloads, smaller payloads, and easier iteration.
Backgrounds accept a comma‑separated list. The first item is the topmost layer, the last is the bottommost. background-color (if set) is below all layers.
.gradify {
/* Top → bottom order */
background-image:
linear-gradient(to bottom, #f33 0%, #00f0 70%),
linear-gradient(to top left, #0f0 0%, #00f0 70%),
linear-gradient(to top right, #00f 0%, #00f0 70%);
}
Paint boxes and coordinates are controlled separately:
background-origin: which box positions the background (border/padding/content)background-clip: which box clips paint (border/padding/content/text)background-position/background-size: per‑layer placement and scaleEach of these can be provided as comma‑separated lists aligned with your layers (covered deeply in Part 2).
linear-gradient(angle, stops...)radial-gradient(size at position, stops...)conic-gradient(from angle at position, stops...)repeating-linear-gradient(...), repeating-radial-gradient(...), repeating-conic-gradient(...)You can freely combine them in a single background-image list.
Preview box (pure CSS, no images):
The code:
.hero-bg {
background-image:
radial-gradient(ellipse at 20% 30%, rgba(56, 189, 248, 0.4) 0%, transparent 60%),
radial-gradient(ellipse at 80% 70%, rgba(139, 92, 246, 0.3) 0%, transparent 70%),
radial-gradient(ellipse at 60% 20%, rgba(236, 72, 153, 0.25) 0%, transparent 50%),
radial-gradient(ellipse at 40% 80%, rgba(34, 197, 94, 0.2) 0%, transparent 65%);
}
Notes:
background-color to maintain consistency.The positioning and clipping boxes matter for precise effects like “inside‑padding only” textures or sharp borders.
.card {
/* Three layers: texture, highlight, base */
background-image:
radial-gradient(12px 12px at 12px 12px, #ffd93d, 50%, transparent 60%),
linear-gradient(180deg, #00ceaf9e, #00ceaf2e 40%),
linear-gradient(180deg, #ffffff60, #3d63ff6e);
/* Position inside content for top two, allow base to paint under border */
background-origin: content-box, content-box, border-box;
background-clip: content-box, content-box, border-box;
background-blend-mode: overlay, normal, normal;
padding: 24px;
border: 2px solid #ffd93d6e;
border-radius: 6px;
}
background-origin picks the box used for position/size coordinates.background-clip defines where paint can appear (here we keep the upper layers away from the border).soft-light, multiply, or overlay for tasteful depth.position/size/repeat/blend-mode) and how lists align.Continue to Part 2 → /blog/css-gradient-layers-controls