CSS Gradient Techniques Beyond the Basics: Mesh, Conic, and Layered Gradients

By Elena Marsh · September 27, 2026 · Design

A two color linear gradient is the start, not the end. With multiple color stops, conic gradients and layered backgrounds you can build depth, lighting and texture in pure CSS.

Most developers learn gradients as a single linear fade between two colors and stop there. CSS is capable of far more: gradients can take any number of color stops, run radially from a point, sweep conically around a center, and stack in layers to produce lighting, depth and texture without a single image. Used well, gradients replace bitmap backgrounds that would otherwise add weight and blur on high density screens.

This guide moves past the two color fade into the techniques that make gradients a serious design tool.

In this article:

The three gradient families

CSS offers linear gradients, which progress along a straight line at an angle you specify; radial gradients, which radiate outward from a central point; and conic gradients, which sweep around a center like a color wheel. Each family has a repeating variant that tiles the gradient, useful for stripes and patterns. All accept multiple color stops and can be combined with each other and with plain background colors in a single declaration.

Multi-stop gradients and color hinting

A gradient is not limited to two colors. Add a third stop and the transition gains a midpoint that changes the character of the fade entirely. A linear gradient from deep blue through purple to soft pink produces a sunset, while the same endpoints with a green midpoint produce something quite different. Each stop can be positioned with a percentage, and an unprefixed hint between two stops shifts where their blend is centered, letting you weight the transition toward one color without adding extra stops.

Conic and repeating gradients

A conic gradient sweeps color around a center point, which is how you build pie charts, color wheels and ray effects in pure CSS. A repeating conic gradient with sharp stops creates a pinwheel or sunburst. Repeating linear gradients with hard stops, where two stops share the same position, produce clean stripes of any width and angle, replacing what once required a tiled image.

Layering gradients with other backgrounds

The background property accepts multiple values separated by commas, drawn in order with the first on top. This lets you layer a subtle radial highlight over a linear base, or place a repeating stripe pattern above a solid color. Because each layer can be a gradient, an image, or a color, you can compose complex surfaces that remain crisp at any resolution and add zero bytes of image payload.

Worked examples

Example one: a sunset hero background

A three stop linear gradient "linear-gradient(160deg, #0b1e3f 0%, #5b2a86 45%, #ff8c69 100%)" produces a diagonal sunset from deep navy at the top left through purple to warm coral at the bottom right. The angle of one hundred and sixty degrees gives the diagonal its direction, and the percentage positions weight the purple toward the upper portion for a more dramatic transition.

Example two: a soft radial spotlight

Layer a radial gradient over a solid base: "background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.25), transparent 60%), #1a2238". The white radial at the top left simulates a light source, fading to transparent so the base color shows through. The result is a surface that looks lit rather than flat, with no image asset.

Example three: diagonal stripes with hard stops

A repeating linear gradient "repeating-linear-gradient(45deg, #e8e8e8 0 12px, #f5f5f5 12px 24px)" produces clean diagonal stripes. Both stops use the shorthand position syntax where the color and its end position are combined, so the first stripe runs from zero to twelve pixels and the second from twelve to twenty four, then the pattern repeats. Adjusting the angle and widths changes the texture without any other change.

Common mistakes

FAQ: gradient edge cases

Are conic gradients supported everywhere?

Conic gradients are supported in all modern browsers but were absent in older ones. Provide a solid or linear fallback before the conic declaration so unsupported browsers still render a reasonable background.

How do I make a gradient transition sharply between colors?

Place two stops at the same position. A gradient with "red 0 50%, blue 50% 100%" produces a hard horizontal split rather than a fade, which is the basis for striped and checker patterns.

Can I animate a gradient?

Background gradients cannot be animated directly with transitions, but you can animate a background position on a larger repeating gradient, or animate an overlay element, to achieve movement. Use transform and opacity for performance.

Wrapping up

Gradients in CSS are a compositing system, not just a fade tool. Combine multiple stops, the three gradient families, and layering to build depth and texture in pure CSS, and provide a fallback so every browser sees something intentional.

Build and preview layered CSS gradients with live output.

Try the Image Converter tool.

SwiftMultiTool — free online tools for everyone. Home · Blog · About · FAQ · Contact