Set angle stops & center position, build pie charts, gauges, and color wheels without SVG. An interactive conic-gradient: Gradien Memutar playground: change…
Why it matters
Pie charts and gauges without SVG, a chart library or canvas: one div is enough. But it only comes out right when you know how the browser reads the stops: when it blends, when it is sharp, and what happens when the angles are out of order.
The key idea
Two stops at the same angle make a sharp edge
Common mistakes
Colours blend when you wanted a sharp slice One angle per colour = a blend from stop to stop. For a sharp edge, start the next colour at the same angle: red 0deg 120deg, blue 120deg 240deg.
Stop angles not in increasing order The browser does not sort. A position smaller than one before it is raised to the largest one before it, so its colour shrinks to a sliver or vanishes. Always write from small angles to large.
Forgetting border-radius: 50% conic-gradient is only a background; the box stays a box. For a full circle the box needs aspect-ratio: 1 plus border-radius: 50%.
Try it in this playground
Drag one of the dots on the circle The text follows. Bring it near another stop’s thread and it snaps onto the same angle.
Make one sharp edge Write the same angle for two neighbouring colours, e.g. red 0deg 120deg, blue 120deg. Its thread turns from dashed to solid.
Write one angle smaller than the one before The stop table shows the angle the browser raised, and the jump is drawn on the circle.
Turn it with from, then move the centre with at E.g. conic-gradient(from 90deg at 30% 70%, …). The 0° line turns too, and every angle counts from the new point.