How to make a CSS gradient and copy the code

A gradient is just CSS, but writing the angle and colours by hand is fiddly. CSS gradient generator shows a live preview as you change them.

Steps

  1. Choose Linear, Radial or Conic.
  2. Set the angle with the slider.
  3. Pick the first and last colours, and tick Add a middle colour for three.
  4. Copy the CSS into your stylesheet.

Use cases

  • Hero section and button backgrounds.
  • Quick placeholder backgrounds.
  • Learning how gradient syntax works.

Tips

  • Gradients between very different colours can look muddy in the middle. A third colour helps.
  • Put text over a gradient only after checking contrast with the Colour contrast checker.
  • Need matching colours? Try the Colour palette generator.

All guides

↑ ↓ navigateEnter openEsc close