CSS radial-gradient() Function
Example
The following example demonstrates a radial gradient - with evenly distributed color stops:
#grad
{
background-image:
radial-gradient
(
red
,
green
,
blue
)
;
}
Try it »
Definition and usage
The radial-gradient() function creates an "image" with a radial gradient.
A radial gradient is defined by a center point.
To create a radial gradient you must set two color stops.
Radial gradient example

Supported version: CSS3
Browser support
The numbers in the table indicate the first browser version that supports the function.
The number prefixed by "webkit", "moz", or "o" indicates the first version that supports the function.
| function | |||||
|---|---|---|---|---|---|
| radial-gradient() | 26.0 | ||||
| 10.0 -webkit- | 10.0 | 16.0 | |||
| 3.6 -moz- | 6.1 | ||||
| 5.1 -webkit- | 12.1 | ||||
| 11.6 -o- |
CSS Syntax
background-image: radial-gradient(shape size at position, start-color, ..., last-color);
| Value | Description |
|---|---|
| shape | Determine the type of circle:
|
- farthest-corner (default): specifies the radius length of the radial gradient from the center to the farthest corner
- closest-side: specifies the radius length from the center to the closest side
- closest-corner: specifies the radius length from the center to the closest corner
- farthest-side: specifies the radius length from the center to the farthest side
- center(default): sets the middle as the vertical coordinate value of the radial gradient's center.
- top: sets the top as the vertical coordinate value of the radial gradient's center.
- bottom: sets the bottom as the vertical coordinate value of the radial gradient's center.
More examples
Example
Unevenly distributed color stops:
#grad
{
background-image:
radial-gradient
(
red
5
%
,
green
15
%
,
blue
60
%
)
;
}
Try it »
Example
Circular radial gradient:
#grad
{
background-image:
radial-gradient
(
circle
,
red
,
yellow
,
green
)
;
}
Try it »
Example
Using different size keywords:
#grad1
{
background-image:
radial-gradient
(
closest-side
at
60
%
55
%
,
blue
,
green
,
yellow
,
black
)
;
}
#grad2
{
background-image:
radial-gradient
(
farthest-side
at
60
%
55
%
,
blue
,
green
,
yellow
,
black
)
;
}
Try it »
CSS Tutorial: CSS3 Gradients
CSS Functions