What a CSS gradient is
A CSS gradient is an image the browser draws from a list of colors. It works anywhere an image does, most often as a background, and because it is drawn rather than downloaded it stays sharp at every size.
There are three kinds. A linear gradient runs along a straight line at an angle. A radial gradient spreads out from a center as a circle or an ellipse. A conic gradient sweeps around a center, like the hand of a clock. Each has a repeating version that tiles the stops when they end before the edge.
How stops, angles and color spaces work
Each color stop pairs a color with a position: along the gradient line for a linear gradient, outwards from the center for a radial one, around the turn for a conic one. Between two stops the browser blends the colors. Two stops at the same position make a hard edge instead of a blend.
When no color space is named, hex and rgb() colors are blended in sRGB, which can turn the middle of two strong colors grey. CSS Color 4 lets you name the space instead: in oklab blends evenly by how light colors look, and in oklch also keeps the chroma, so the middle stays vivid.
linear-gradient(135deg, #0e4d64 0%, #2a9d8f 45%, #e9c46a 100%) 135deg toward the bottom right #0e4d64 0% first color at the start #2a9d8f 45% reached 45% of the way along #e9c46a 100% last color at the end Hard edge: #0e4d64 50%, #e9c46a 50% In OKLCH: linear-gradient(135deg in oklch, …)
Gradients in client and studio work
A gradient in a brand or a product interface is a design decision like any color, so treat it that way: name it, store it with the other tokens and get it approved from a real preview, not a description.
Very gentle gradients across a large area can show visible steps on some screens. A little more difference between the stops, or a fine texture over the top, usually hides them.
- Check text contrast against both ends of the gradient, not only the middle
- Keep gradient colors in your design tokens so they change with the palette
- Use two stops at one position for stripes, progress bars and split backgrounds
- Try OKLCH for brand gradients between strong colors that turn grey in sRGB
- Send the CSS together with the approved preview, so build matches design