Australian Jeevitham TECHDeveloper tools

Tech / CSS Gradient & Shadow Generator

CSS Gradient & Shadow Generator

Build a gradient or a box shadow with sliders, watch the preview change, and copy the CSS.

Gradient

Colour stops

Box shadow

CSS gradients and shadows

CSS has three kinds of gradient. A linear gradient changes colour along a straight line - 90deg runs left to right and 180deg top to bottom. A radial gradient spreads out from a centre point, and a conic gradient sweeps around a centre, like a colour wheel or pie chart.

How to make a shadow look real

  • Move it down a little, not sideways - light usually comes from above.
  • Use a large blur with a small negative spread, so the shadow is soft and tucked under the box.
  • Keep the opacity low, about 15-30%. Strong black shadows look heavy.
  • For extra depth, combine two shadows separated by a comma: a small, sharp one close to the box and a large, soft one further away.

What is an inset shadow?

Ticking "Inset" draws the shadow inside the box instead of outside it. It is useful for pressed buttons, input fields and panels that should look sunk into the page.

Tips for smooth gradients

A gradient between two very similar colours over a large area can show visible stripes, called banding. Adding a middle colour stop, or slightly more difference between the colours, usually fixes it. Also check that any text on a gradient has enough contrast at both ends - try the colour converter and contrast checker.

A note on performance

Gradients and shadows are cheap for browsers to draw once, but animating box-shadow redraws it on every frame. For hover effects, animate transform or opacity instead, for example by fading in a shadow on a pseudo-element.