liveBook · Manning

Conic gradient

As explained in CSS in Depth, Second Edition

The CSS conic-gradient() function generates a conic gradient image from color stops and optional angle, position, and color-interpolation parameters.

A conic gradient changes color around an ellipse in a circular direction, unlike a radial gradient, which changes color outward from its center. CSS creates one with conic-gradient(), or repeats the pattern with repeating-conic-gradient(). section 13.1.4

Basic conic gradient

Apply a conic gradient as a background image: .fade { height: 200px; width: 400px; background-image: conic-gradient(white, blue); } Because the gradient wraps from its final color stop back to its first, contrasting colors can create a hard seam. Repeat the first color at the end—conic-gradient(white, blue, white)—to avoid that abrupt transition. section 13.1.4

Customize the gradient through its initial parameters and color-stop positions:

  • Set the starting angle with from <angle>; the default is 0deg, pointing straight up. section 13.1.4
  • Move the gradient center with at <x-position> <y-position>, measured from the element’s top-left corner. section 13.1.4
  • Choose a color-interpolation method with in <color-space>, and place color stops using percentages or angles. section 13.1.4
Figure 13.10 A conic gradient changes color in a circular direction.
figure

Use the figure to see how a conic gradient distributes color around a circular path. section 13.1.4

How CSS in Depth, Second Edition covers it

How deep it goes
Explains syntax, wraparound seams, angles, centers, color spaces, and stop positions without descending into browser internals.
Examples
Uses a white-to-blue CSS gradient, a repeated endpoint color, and a figure showing circular color distribution.
What it assumes
Assumes basic CSS background-image usage and teaches conic-gradient syntax alongside related gradient types.
What you can do after
Build it from scratch by defining a conic-gradient() background and adjusting its angle, center, color space, and stops.
How it connects
Connects conic gradients with linear gradients, radial gradients, color interpolation, color spaces, color stops, and background images.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of CSS in Depth, Second Edition. The section links point to the parts of the book it draws on.