How CSS Conic Gradients Work
The CSS conic-gradient() function creates a gradient that sweeps around a center point. Think of it like a color wheel: colors transition as you move clockwise. The syntax β conic-gradient(from 0deg at 50% 50%, red, yellow, green, blue, red) β specifies a starting angle, center position, and color stops distributed around the full 360 degrees.
Pie Charts with Pure CSS
Create CSS-only pie charts using hard color stops. Place two stops at the same degree position to create a sharp boundary between segments: conic-gradient(#ff0000 0% 33%, #00ff00 33% 66%, #0000ff 66% 100%). This creates three equal slices. Combine with border-radius: 50% for a round pie chart.
The Starting Angle
The from keyword rotates the gradient's starting point. By default, the gradient begins at 12 o'clock (0deg). Setting from 90deg rotates it to start at 3 o'clock. Combine the starting angle with the at keyword to control both rotation and center position.