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 :     
  1. Shape : shape of the gradient, it can be circle or ellipse       
  2. Size : denotes the size of gradient, possible values are closest side, closest-corner, farthest-side, farthest-corner (default value)     
  3. Position : mentions gradients position     
  4. color-stops : defines the colors which will be rendered in radial gradient.

Values to try :

  1. Shapes : circle or ellipse(default shape)       
  2. Sizes : closest-corner, farthest-corner(default),closest-side,farthest-side         
  3. 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

      Popular posts from this blog

      Day 9: CSS - Font Formate

      else-if condition in if-else statements: Concatenation in JavaScript :

      Day 27: Css Variable