CSS conic-gradient() Function
Last Updated :
30 Aug, 2024
The conic-gradient() function is an inbuilt function in CSS that is used to set a conic gradient as the background image. The conic gradient angle starts from 0 degrees - 360 degrees. Conic are circular and use the center of the element as the source point for color stop.
Conic Gradients include pie charts and color wheels. The result of the conic-gradient() function is an object of the data type, which is a special kind of image.
Syntax:
Background image: conic-gradient(color degree, color degree, ...)
Conic gradients are similar to radial gradients, except that the color stops are on the outer edge of the circle that gets created.
Example:
RADIAL GRADIENT:

CONIC GRADIENT:

Below example illustrates the conic-gradient() function in CSS:
Example 1: In this example, The .box element with class.a applies a conic gradient background from red to yellow to green.
html
<!DOCTYPE html>
<html>
<head>
<title>conic gradient</title>
<style>
.box {
background-color: yellow;
height: 200px;
width: 200px;
float: left;
margin: 20px;
border-radius: 50%;
}
.a {
background-image:
conic-gradient(red, yellow, green);
}
</style>
</head>
<body>
<div class="box a"></div>
</body>
</html>
Output:

Example 2: In this example, The .box element with class .b applies a conic gradient background from red to yellow to green, starting from a 60-degree angle.
html
<!DOCTYPE html>
<html>
<head>
<title>conic gradient</title>
<style>
.box {
background-color: yellow;
height: 200px;
width: 200px;
float: left;
margin: 20px;
border-radius: 50%;
}
.b {
background-image: conic-gradient(from 60deg, red, yellow, green);
}
</style>
</head>
<body>
<div class="box b"></div>
</body>
</html>
Output:

Example 3: In this example, The .box element with class .c applies a repeating conic gradient background from red to yellow to green and back to red.
html
<!DOCTYPE html>
<html>
<head>
<title>conic gradient</title>
<style>
.box {
background-color: yellow;
height: 200px;
width: 200px;
float: left;
margin: 20px;
border-radius: 50%;
}
.c {
background-image:
conic-gradient(red, yellow, green, red);
}
</style>
</head>
<body>
<div class="box c"></div>
</body>
</html
Output:

Example 4: In this example, The .box element with class .d applies a repeating conic gradient background with alternating red and yellow sectors.
html
<!DOCTYPE html>
<html>
<head>
<title>conic gradient</title>
<style>
.box {
background-color: yellow;
height: 200px;
width: 200px;
float: left;
margin: 20px;
border-radius: 50%;
}
.d {
background-image:
repeating-conic-gradient(red 0deg, red 10deg, yellow 10deg, yellow 20deg);
}
</style>
</head>
<body>
<div class="box d"></div>
</body>
</html>
Output:

Example 5: In this example, The .box element with class .e applies a conic gradient background with sectors of different colors: red, yellow, green, and blue.
html
<!DOCTYPE html>
<html>
<head>
<title>conic gradient</title>
<style>
.box {
background-color: yellow;
height: 200px;
width: 200px;
float: left;
margin: 20px;
border-radius: 50%;
}
.e {
background-image:
conic-gradient(red 0deg, red 90deg,
yellow 90deg, yellow 180deg,
green 180deg, green 270deg,
blue 270deg, blue 360deg);
}
</style>
</head>
<body>
<div class="box e"></div>
</body>
</html>
Output:

Supported Browsers:
- Google Chrome 69 and above
- Edge 79 and above
- Firefox 83 and above
- Internet Explorer not supported
- Opera 56 and above
- Safari 12.1 and above
Similar Reads
CSS attr() Function The attr() function is an inbuilt function in CSS that returns the value of an attribute of the selected elements.Syntax: attr( attr_name )Parameter: This function accepts a single parameter attr_name which is used to hold the name of the attribute in an HTML element. It is a mandatory parameter.Ret
2 min read
CSS blur() Function The CSS blur() function applies a Gaussian blur effect to an element, making it appear out of focus. It is used with the filter property and accepts a length value defining the blur radius. CSS blur() function is part of the CSS filter property, which allows you to apply graphical effects like blurr
3 min read
CSS brightness() Function The brightness() function is an inbuilt function which is used to apply a filter to set the brightness of the image. This function uses the linear multiplier to the image to increase or decrease brightness. Syntax: brightness( amount ) Parameters: This function accepts single parameter amount which
1 min read
CSS calc() Function The calc() function is an inbuilt CSS function used to perform calculations to determine CSS property values dynamically. This function allows combining different units, such as percentages and pixels, using basic arithmetic operations like addition, subtraction, multiplication, and division. This a
4 min read
CSS circle() function The circle() function is an inbuilt function in CSS that is used to create floating text around the circular shape picture or anything else. Syntax: circle(100px at 10px 150px); or circle( percentage ); Parameters: This function accepts a single parameter length or percentage which is used to hold t
3 min read
CSS conic-gradient() Function The conic-gradient() function is an inbuilt function in CSS that is used to set a conic gradient as the background image. The conic gradient angle starts from 0 degrees - 360 degrees. Conic are circular and use the center of the element as the source point for color stop. Conic Gradients include pie
3 min read
CSS contrast() Function The contrast() function is an inbuilt function which is used to apply a filter to set the contrast of the image. This function adjusts the contrast of the image. Syntax: contrast( amount ) Parameters: This function accepts single parameter amount which holds the amount of contrast. The value of cont
1 min read
CSS cubic-bezier() Function The cubic-bezier() function is an inbuilt function in CSS that is used to define a Cubic Bezier curve. A Bezier curve is a mathematically defined curve used in two-dimensional graphic applications like adobe illustrator, Inkscape, etc. The curve is defined by four points: the initial position and th
1 min read
CSS drop-shadow() Function The CSS drop-shadow() function adds a shadow effect to elements, like images, using horizontal and vertical offsets, blur radius, spread radius, and color parameters. It enhances visual depth and prominence in web design.Syntax:filter: drop-shadow(offset-x offset-y blur-radius spread-radius color);P
2 min read
CSS ellipse() Function The ellipse() function is an inbuilt function in CSS used to create floating text around the ellipse shape picture or anything else. Syntax:circle(100px 10 px at 10px 150px);orellipse( percentage percentage );Parameter: This function accepts a single parameter length or percentage which is used to h
3 min read