Gradients
CSS Gradient Generator
A focused tool for producing clean, copy-ready linear-gradient CSS. Choose two colors, set the angle, and copy the exact code in whichever format fits your project.
Output format
All three formats produce identical visual output — pick whichever fits your stylesheet.
How to use this CSS gradient generator
- Pick your start color and end color — type a HEX code or use the color input.
- Drag the angle slider to change the gradient direction (0° = bottom-to-top, 90° = left-to-right).
- Choose your output format:
background,background-image, or a reusableCSS variable. - Click Copy CSS and paste directly into your stylesheet.
Understanding the CSS output
Each format outputs the same gradient using a slightly different CSS property:
| Format | Use when | Example |
|---|---|---|
background | Quick single-use gradient on an element | background: linear-gradient(90deg, #267D70, #8BAF9E); |
background-image | You also want to set background-color separately (fallback) | background-image: linear-gradient(90deg, #267D70, #8BAF9E); |
| CSS variable | You want to reuse the gradient across many classes | --gradient: linear-gradient(…); |
Common gotchas
- Gradients + text: text over a gradient needs consistent contrast across the full transition. Test both ends with the Contrast Checker.
- Muddy middles: two distant colors often blend to a dull gray in the middle. Add a mid-stop to keep saturation high (use the full Gradient Generator for multi-stop gradients).
- Print: gradients on print media may not render as expected. Convert to an image if you need pixel-accurate output.
FAQ
Is linear-gradient supported everywhere?
Yes. The syntax has been supported in every major browser since 2013.
Can I create radial or conic gradients here?
This page focuses on linear gradients for clean output. Use the full Gradient Generator for radial and conic modes.
Do I need a fallback background color?
Yes, it's good practice. Set a solid
background-color before background-image so users on older browsers still see a colored surface.