Skip to content
Tutorials Center
My learning

Topics

CSS Reference ยท Functions

The radial-gradient() function

Reference for the CSS radial-gradient() function: circle and ellipse shapes, size keywords, center position, color stops, spotlights and live examples.

The radial-gradient() function creates an image where colors radiate outward from a center point, like a spotlight, a glow or a sphere. As with every gradient it is used where an image is accepted, usually background-image or the background shorthand.

CSS
.glow {
  background: radial-gradient(circle at 30% 30%, #fde68a, #f59e0b 60%, #7c2d12);
}

Try it

Shapes, sizes and positions

Syntax

CSS
radial-gradient(
  [ <shape> || <size> ]? [ at <position> ]? [ in <color-space> ]?,
  <color-stop-list>
)

Syntax and arguments

Argument Description
Shape ellipse (default) or circle.
Size closest-side, closest-corner, farthest-side, farthest-corner (default), or explicit lengths: one for a circle, two for an ellipse (percentages allowed for ellipses).
at <position> The center, using the same syntax as background-position: keywords, lengths or percentages. Default: center.
Color stops Colors with optional positions along the radius, like in linear-gradient(). 0% is the center.

Usage notes

  • The default ellipse stretches to the box's aspect ratio. Write circle when you want round shapes in a rectangular box.
  • Size keywords define where the final (100%) stop sits; farthest-corner makes the color reach the farthest corner, so the visible gradient seems "slower" than closest-side.
  • Hard edges. Two stops at the same length draw a crisp circle, as in the "30px" example.
  • Spotlight effects. Combine a transparent-to-dark radial gradient with a custom property for position and update it on pointer movement.
  • Layering. Several radial gradients, separated by commas, are the basis of many CSS-only patterns (dots, bubbles).
  • Not for background-color. It is an image value.
  • Contrast. Check text contrast at every point of the gradient.

Browser support

Supported in every modern browser. The optional in <color-space> part is newer; check a compatibility table.