CSS conic-gradient() Function
Example
A conic gradient of three colors:
#grad
{
background-image:
conic-gradient
(
red
,
yellow
,
green
)
;
}
Try it »
Definition and usage
The conic-gradient() function creates an image consisting of a gradient.
A conic gradient is a color transition that rotates around a central point (rather than radiating outward from the center).
To create a conic gradient, at least two color stops must be set.
Conic gradient example:

From the figure you can see the gradient direction and starting point of the conic gradient. The starting point is the center of the figure, and the gradient proceeds clockwise around the center.
| Version: | CSS3 |
|---|
Browser support
The numbers in the table indicate the first browser version that supports the function.
| function | |||||
|---|---|---|---|---|---|
| conic-gradient() | 69.0 | 79.0 | 83.0 | 12.1 | 56.0 |
CSS Syntax
background-image: conic-gradient([from angle] [at position,] color degree, color degree, ...);
| Value | Description |
|---|---|
| from angle | Optional. The starting angle. Default is 0deg |
| at position | Optional. The center position. Default is centered. |
| color degree, ..., color degree | Angular gradient stop. The value contains a color value followed by an optional stop position (an angle between 0 and 360 degrees or a percentage between 0% and 100%). |
More examples
Example
A conic gradient of five colors:
#grad
{
background:
conic-gradient
(
red
,
orange
,
yellow
,
green
,
blue
)
;
}
Try it »
Example
A conic gradient of three colors, with the degree of each gradient set:
#grad
{
background-image:
conic-gradient
(
red
45
deg
,
yellow
90
deg
,
green
210
deg
)
}
Try it »
Example
By setting border-radius: 50% Turn the conic gradient into a circle:
#grad
{
background-image:
conic-gradient
(
red
,
yellow
,
green
,
blue
,
black
)
;
border-radius:
50
%
;
}
Try it »
Example
Set the starting angle:
#grad
{
background-image:
conic-gradient
(
from
90
deg
,
red
,
yellow
,
green
)
;
border-radius:
50
%
;
}
Try it »
Example
Specify the center position:
#grad
{
background-image:
conic-gradient
(
at
60
%
45
%
,
red
,
yellow
,
green
)
;
border-radius:
50
%
;
}
Try it »
Example
Specify a position and set an angle:
#grad
{
background-image:
conic-gradient
(
from
90
deg
at
60
%
45
%
,
red
,
yellow
,
green
)
;
border-radius:
50
%
;
}
Try it »
Example
A pie chart:
#grad
{
background-image:
conic-gradient
(
red
0
deg
,
red
90
deg
,
yellow
90
deg
,
yellow
180
deg
,
green
180
deg
)
;
border-radius:
50
%
;
}
Try it »
background-image: conic-gradient(red 0deg, red 90deg, yellow 90deg, yellow 180deg, green 180deg);
Code analysis:
- red 0deg, red 90deg Red is used for the 0-90 degree range.
- yellow 90deg, yellow 180deg Yellow is used for the 90-180 degree range.
- green 180deg Green is used for the 180-360 degree range.
Example
Create a color picker:
#grad
{
background:
radial-gradient
(
closest-side
,
gray
,
transparent
),
conic-gradient
(
red
,
magenta
,
blue
,
aqua
,
lime
,
yellow
,
red
)
;
border-radius:
50
%
;
}
Try it »
CSS Functions