Good to know
What the CSS means
background-color: #2193b0; background-image: linear-gradient(90deg, #2193b0 0%, #6dd5ed 100%);
The first line is the fallback: the colour of the first stop, used if gradients are switched off or a very old browser cannot draw them. The second line is the gradient. Each stop is a colour followed by its position along the gradient.
Angles and positions
- Linear:
0degruns from bottom to top,90degfrom left to right and180degfrom top to bottom. The angle turns clockwise. - Radial: colours spread out from the Centre you choose.
circlekeeps the rings round;ellipsestretches them to the shape of the box. - Conic: colours sweep round the centre like a clock hand, starting at the angle you set (
from 0degis twelve o'clock). Give the last stop the same colour as the first for a seamless wheel.
Stops in practice
Stops are sorted by position in the output, so you can set them in any order. Two stops at the same position make a hard edge instead of a blend: #2c3e50 50%, #fd746c 50% gives a crisp two-tone split. Reverse mirrors every position, so a stop at 30% moves to 70%.
Readability and banding
When text sits on a gradient, its contrast changes across the area. The contrast checker tests one pair at a time, so check your text colour against the lightest and the darkest stop behind it. Long, subtle blends between two close colours can show faint stripes on some screens. That comes from the limited number of shades a display can show, not from a mistake in your CSS, and a slightly larger colour difference usually hides it.