CSS gradients allow us to create color transitions without using images. With them, we can design modern, responsive, and aesthetic backgrounds.
A linear gradient changes colors along a straight line. The direction can be specified with keywords (to right, to bottom) or with angles (45deg).
In the following example, we define a linear gradient from red to yellow:
A radial gradient spreads in a circle, while a conic gradient changes colors in a radial direction from a center point. These provide unique visual effects.
A radial gradient can be useful for creating light effects or central highlighting.
In gradients, we can specify multiple colors, with exact positions (color stops) to control the transition.
With rgba colors or opacity, we can create transparent gradients, for example for shading over images.
Repeating-linear-gradient and repeating-radial-gradient allow us to create repeating patterns in backgrounds.
Using gradients helps create dynamic and modern interfaces. The following advice may help:
✨ Ask Lara — your AI study partner
Unlock personalized learning support. Lara can explain lessons, summarize topics, and answer your study questions — available from the Go plan and above.
Lara helps you learn faster — exclusive to ReadyTools Go, Plus, and Max members.