What a linear gradient replaces

A linear gradient is a generated image whose colour varies continuously along a straight line. Before it existed, a header fade meant exporting a PNG one pixel wide and stretching it, or stacking a hundred absolutely positioned divs. A gradient is resolution independent, weighs nothing to download, and can be restyled by editing a hex value instead of opening an image editor.

The tool builds the whole declaration for you. Choosing the Bottom-right preset and leaving the two default colours alone yields:

background: linear-gradient(135deg, #f43f5e 0%, #fbbf24 100%);

Read it as three parts: a direction, then a comma-separated list of colour stops, each a colour plus a position.

Direction: the eight presets are just numbers

Every direction button maps to a degree value, and the angle slider is the same control with the labels removed.

PresetAngleEquivalent keyword
Top0degto top
Top-right45degto top right
Right90degto right
Bottom-right135degto bottom right
Bottom180degto bottom
Bottom-left225degto bottom left
Left270degto left
Top-left315degto top left

The one thing to memorise: 0deg points up and angles increase clockwise. This is the opposite of the mental model most people bring from mathematics, where zero points right and angles run anticlockwise. So 90deg is "to right", and the generator normalises any value you type into the 0 to 359 range before writing the CSS.

Angle, and why 45deg is not corner to corner

The gradient line runs through the centre of the box, and its 0% and 100% points are where that line meets perpendiculars drawn from the corners. On a square box at 45deg those points coincide with two opposite corners, so the gradient spans the whole element exactly. On a wide box it does not: the gradient line is longer than the diagonal you had in mind, and the 0% and 100% points fall outside the visible area. The practical result is that a diagonal gradient on a wide banner looks gentler than expected, because the extreme colours are cropped away. If you want the colours to reach the actual corners on a non-square element, set the angle to match the box's proportions rather than assuming 45deg will do it.

Colour stops

Each stop is a colour and a position, and the position is a percentage of that gradient line. The generator starts with two stops at 0% and 100% and lets you add up to six. When you add one, it keeps the list readable by re-spreading every stop evenly — three stops become 0%, 50%, 100%; four become 0%, 33%, 67%, 100% — so you are never left with a stop stranded on top of another one. You can then drag any of them to a custom value.

Three stop behaviours are worth knowing because they are pure CSS, not tool features:

Where linear gradients go wrong

Questions about linear gradients

How do I make a gradient repeat?

Swap the function for repeating-linear-gradient() with the same arguments, and the pattern tiles along the gradient line at the interval between the first and last stop. This generator emits the non-repeating form; change the function name by hand.

Can I apply a gradient to text?

Yes, but not with this property. Set background-image to the gradient, then -webkit-background-clip: text plus background-clip: text and a transparent text colour. Keep a solid fallback, because a fully transparent heading is invisible if the clipping is not applied.

Why does my gradient look different in different browsers?

It should not, for the plain sRGB form. Differences usually come from banding and dithering choices on large gradients, or from an interpolation colour space that only some browsers support.

What is the difference between 45deg and "to top right"?

The keyword form aims at the corner, whatever angle that requires for the box's aspect ratio. The degree form is a fixed direction, so on a non-square element the two are not the same.

Do gradients hurt performance?

A gradient is rasterised once and then reused, so a static one is cheap. Animating its position or its stop values forces a repaint of the whole element on every frame, which is far more expensive than animating a composited property such as transform or opacity.