GUIDE深度 · Deep dive

CSS Gradients Basics

A gradient is a background-image, not a background-color. linear-gradient transitions along an angle, radial-gradient spreads from a center, and color stops decide where colors land.

更新 2026-10-31 · 公式可核验

Syntax

linear-gradient(135deg, #6d5efc, #22d3ee).

radial-gradient(circle, #6d5efc, #22d3ee).

Fallback: set background-color first.

Angles

0deg points up, 90deg right, 180deg down.

to right and to bottom are more readable.

FAQ

Can gradients animate?

Yes, but watch performance and prefers-reduced-motion.

Why does it disappear when printing?

Browsers skip backgrounds by default; use print-color-adjust.

Sources

Related calculators

CSS Gradient GeneratorPick two colors and an angle, preview live and copy the CSS gradient code.

More guides

Text Readability on GradientsRead guide