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.
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.