CSS Gradient Generator
Build linear or radial CSS gradients from two or three colours, set the angle, preview the result and copy the CSS.
Build linear or radial CSS gradients from two or three colours, set the angle, preview the result and copy the CSS.
A CSS gradient is a smooth blend between two or more colours, written as a background value. Linear gradients run along an angle, radial gradients spread out from the centre.
Enter your colours, adjust the angle, check the preview and copy the CSS.
background: linear-gradient(45deg, #ff8800, #0055ff);
A CSS gradient is an image generated by the browser, so it is used where a background image is allowed, via the background or background-image property, not as a plain colour. In a linear gradient, the angle sets the direction of the gradient line: 0deg points to the top, 90deg to the right and 180deg to the bottom. Colours blend along that line, and each colour stop can have a position in percent or length. Without positions, stops are spaced evenly. A radial gradient spreads outwards from a centre point, by default as an ellipse sized to the box.
Appearance details are worth knowing. By default browsers interpolate in the sRGB colour space, so blending between two saturated colours, such as blue and yellow, can pass through a dull grey zone in the middle. Adding an intermediate stop with a deliberately chosen colour avoids this. Banding, visible stripes in smooth gradients, can appear on large areas with close colours, and a slight noise texture can hide it. Text placed on a gradient must keep enough contrast across the whole background, so check contrast at the lightest and darkest areas, not just at one end. Gradients scale without extra requests, which makes them lighter than image files.
Anything CSS accepts: HEX, rgb(), hsl() and colour names.
0deg points up and 90deg points right. The gradient runs in that direction.
One of the colours may not be valid CSS. Check the spelling.
This tool supports up to three. You can add more by editing the CSS.
Yes, with extra CSS. Apply the gradient as the background, clip it to the text with background-clip set to text, and make the text colour transparent. Browser prefixes may be required for older versions.
Give two adjacent colour stops the same position, for example red 50 percent and blue 50 percent. The colour switches abruptly at that point instead of fading.