Pick colors, drag the angle, preview the linear-gradient live and copy the CSS in one click.
| Type | Direction | Typical use |
|---|---|---|
linear-gradient | Along a straight line at any angle | Buttons, headers, background bands |
radial-gradient | Outward from a centre point | Spotlights, glows, vignettes |
conic-gradient | Sweeping around a centre | Pie charts, colour wheels, progress rings |
A linear gradient's angle is measured clockwise from the top, so 0deg runs bottom-to-top and 90deg runs left-to-right. Keywords such as to bottom right are usually easier to read than the equivalent angle.
Each stop is a colour with an optional position: linear-gradient(90deg, #6366f1 0%, #a855f7 100%). Moving two stops to the same position produces a hard edge with no blending — a neat way to build striped bars and pie slices without extra elements. Leaving a position out lets the browser distribute the stops evenly.
Browsers interpolate in sRGB by default, which is not perceptually uniform. Blending complementary colours — orange to blue, say — passes through a muddy grey rather than the vivid middle you expected. The fix is to interpolate in a perceptual space, which modern CSS supports by naming it inside the function, or to hand-place an intermediate stop that is more saturated than the average of the two ends.
transform is usually smoother.The keyword transparent is shorthand for rgba(0, 0, 0, 0) — fully transparent black. Interpolating toward it blends the colour channels as well as the alpha, so an orange fading to transparent passes through a dirty brown before it disappears. The fix is to name the same colour with zero alpha instead:
/* fades through grey-brown */
background: linear-gradient(to right, #f97316, transparent);
/* stays orange the whole way */
background: linear-gradient(to right, #f97316, rgba(249,115,22,0));
The difference is obvious over photographs and video, where a grey band reads as a rendering fault rather than a fade. The same applies to box-shadow and text-shadow, which have the identical behaviour.