conic-gradient() and repeating-gradient()
What you'll learn: How to create pie-chart-style gradients and repeating patterns for eye-catching background effects.
What is conic-gradient()?
Think of conic-gradient() like slicing a pie. Instead of colors transitioning from one side to another (linear) or center to edge (radial), they sweep around a central point in a circular motion. This makes it perfect for creating pie charts, color wheels, or sunburst patterns.
The basic syntax positions color stops around a 360-degree circle:
.pie-chart {
background: conic-gradient(red 0deg 120deg, blue 120deg 240deg, green 240deg);
}
You can specify a starting angle and center position:
.color-wheel {
background: conic-gradient(from 90deg at 50% 50%, red, yellow, green, blue, red);
}
What are repeating gradients?
Just like wrapping paper patterns, repeating-linear-gradient(), repeating-radial-gradient(), and repeating-conic-gradient() tile their color patterns automatically. Once the gradient reaches its final color stop, it starts over.
.striped-background {
background: repeating-linear-gradient(45deg, black 0px, black 10px, yellow 10px, yellow 20px);
}
.target-pattern {
background: repeating-radial-gradient(circle, red 0px, red 20px, white 20px, white 40px);
}
.spinning-stripes {
background: repeating-conic-gradient(from 0deg, blue 0deg 10deg, white 10deg 20deg);
}
These create seamless, tiling patterns without needing image files—perfect for backgrounds, loading indicators, or decorative elements.
Key Takeaway: conic-gradient() sweeps colors around a center point for pie-chart effects, while repeating gradient functions automatically tile patterns for infinite background designs.