CSS gradient generator
0° points up, 90° to the right, 180° down - clockwise, unlike the angles in maths class.
background: #a856d6; background: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
The first line is a solid fallback, the average of your colours. It shows wherever the gradient line is ignored.
Making CSS gradients that look right
A CSS gradient is an image the browser draws for you: no file to download, sharp at any size and easy to change. This generator writes the background property for linear (a straight band of colour), radial (spreading out from a point) and conic (sweeping around a point, like a colour wheel or pie chart) gradients, and shows the result as you edit.
How to use it
- 1 Pick a preset or choose linear, radial or conic, then set the angle, the shape or the centre.
- 2 Edit the colour stops: click the swatch or type a hex code, set where each colour sits (0-100%) and how opaque it is. Add stops for more colours.
- 3 Copy the two CSS lines and paste them into the rule for your element, for example a hero section or a button.
Which way does the angle point?
In CSS the angle is the direction the gradient travels towards: 0deg goes up, 90deg goes right and 180deg, the default, goes down. It turns clockwise, the opposite of the maths convention, so designs copied from a graphics program often come out mirrored. The keyword to top right is not the same as 45deg either: the keyword aims at the corner of the box, so on a wide banner it is much flatter than 45 degrees.
Hard lines, stripes and stop order
Colours blend between stops. Put two stops at the same position and there is no room to blend, so you get a crisp line: blue 0%, blue 50%, red 50%, red 100% gives a half-and-half split, as in the stripes preset. A stop whose position is smaller than the one before it is pulled forward to that earlier position, which also makes a hard edge, usually by accident. That is why this tool always writes the stops in position order, and the sort button puts the rows in the same order on screen.
Fading to transparent
For a shadow or a dark band behind text on a photo, fade a colour to the same colour at 0% opacity, as the last preset does, rather than to the keyword transparent. transparent means transparent black, and older browsers blended through it, leaving a greyish haze in the middle. Current browsers handle it correctly, but the same-colour stop is safe everywhere and makes the intent obvious. The chequered pattern behind the preview shows exactly how see-through each part is.
Radial, conic and the fallback line
A radial circle stays round on any box, while an ellipse stretches to the box’s proportions, which suits wide headers. Conic gradients sweep around the centre and are handy for colour wheels, pie charts and loading rings; start and end with the same colour for a seamless loop. The extra background line with a single colour is not decoration: if the gradient line has a typo, the browser drops that whole line and uses the one before it, and email clients that ignore gradients show it too.