Guide: create linear and radial CSS gradients
Hero sections and buttons use `linear-gradient` with multiple stops and `deg` angles. Tweaking DevTools without a side-by-side preview slows design iteration.
Stops and angle update an in-browser preview — no assets hit a server. Export ready-made `background` or `background-image` declarations.
Use for prototypes, brand tokens, and hover states. Check text contrast over the gradient with the color converter — WCAG needs minimum ratios.
Step by step
- Pick linear or radial — Linear uses angle; radial uses center position and ellipse/circle shape.
- Add color stops — Drag percentages (`0%`, `50%`, `100%`) for smooth blends or hard bands.
- Tune on the preview — Test with real typography — dark top gradients help white headline contrast.
- Copy the CSS — Paste into modules, Tailwind arbitrary `bg-[linear-gradient(...)]`, or `--gradient-*` variables.