Day 26: Radial Gradient
.grid{
width: 500px;
height: 500px;
background-image: radial-gradient(red, yellow, green);
}
.grid{
width: 500px;
height: 500px;
background-image: radial-gradient(red 15%, yellow 25%, green 50%);
}
.grid{
width: 500px;
height: 500px;
background-image: radial-gradient(circle, red, yellow, green);
}
1. Radial gradient :
- The background image is set to a radial gradient using the radial-gradient() method.
- It results in a gentle transition between two or more colors coming from the same source. (Center)
- Its form could either be circular or elliptical.
- Syntax :
background-image : radial-gradient(shape, size, position, starting color…..ending color)
- Values :
- Shape : shape of the gradient, it can be circle or ellipse
- Size : denotes the size of gradient, possible values are closest side, closest-corner, farthest-side, farthest-corner (default value)
- Position : mentions gradients position
- color-stops : defines the colors which will be rendered in radial gradient.
Values to try :
- Shapes : circle or ellipse(default shape)
- Sizes : closest-corner, farthest-corner(default),closest-side,farthest-side
- Starting and ending color : color stops of your choice can be defined, percentage can also be given ranging from 0 to 100% which defines the stop position for color provided.
Example :
The following code creates a radial gradient in the shape of an ellipse, transitioning from yellow, to blue to purple, originating from the center going towards the circumference.
Code :
Output :
Comments
Post a Comment