Skip to content
en

CSS gradient generator

A ready background-image line with linear- or radial-gradient: two colors, two stops and an angle. Shows the gradient line and the blend band.

Input

#4f46e5
#06b6d4

Result

Fill in the fields – the result will appear here.

Report a problem
This will be sent with your message:
Advertisement

How a CSS gradient works

A gradient is an image, not a color

background-image: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%); – it's background-image, not background-color. That's why a gradient can sit on top of a solid background color, and why it doesn't work where a color is expected: in border-color or color.

The angle is counted from up

0deg points up, 90deg right, 180deg down. The angle grows clockwise. This is the most common mistake: in trigonometry the count goes counter-clockwise and starts on the right, in CSS it's the other way round.

Stops are percent of the line, not of the sides

The gradient line runs through the element's center at the set angle, and 0% is its start, 100% its end. Before the first stop the color is solid, and after the last one too. So #4f46e5 40%, #06b6d4 60% gives solid edges and a blend only in the middle.

Equal stops give a sharp edge

If the start and end are the same, the colors meet with no blend. That's how two-color backgrounds and flags are made – one gradient instead of two blocks.

What repeating- does

repeating-linear-gradient() takes the band between the first and last stop and repeats it to the end of the element. Stripes, a ruler, hatching – all of it is one short repeated gradient.

Radial goes from the center

radial-gradient(circle, …) has no angle: the blend goes outward from the center. circle keeps the circle round in any element, while the default ellipse stretches with it.

Common questions about CSS gradients

Why is my gradient not visible?

Three usual reasons: it's in background-color instead of background-image, the element has zero height, or both colors are the same.

How many colors can I use?

As many as you like – separated by commas, each with its own percent. This page builds a two-color gradient; a third is added to the same line the same way.

How do I put a gradient on text?

Put the gradient on the element's background and clip it to the letters: background-clip: text with a transparent color. The gradient itself stays a normal background-image.

How is linear-gradient different from conic-gradient?

Linear goes along a straight line, conic goes around the center, like a clock face. Conic is used for pie charts and a "shine" effect.

Why does the blend look muddy?

Most often because the two colors are from opposite sides of the color wheel: grey appears in the middle. Two neighbouring hues with different brightness give a cleaner blend.

Advertisement

Report a problem

This will be sent with your message: