arman_aegit
0
Q:

linear gradient in CSS

#grad {
  background-image: linear-gradient(to right, #f1b1b1 , #82e6e8);

}
3
background: linear-gradient(to left, red, blue);
9
.foo {
	background-image: linear-gradient(red, blue);
}
8
background: linear-gradient(to left, #333, #333 50%, #eee 100%);
6
.element {
    background: linear-gradient(pink 50%, cyan 50%);
}
3
The general syntax of linear-gradient is-
background: linear-gradient(gradient direction, color1 , color2 , color3, .....);

Forexample-
background: linear-gradient(46deg,green,blue,yellow,pink);

NOTE: (common mistake) we forget to write the semi-colon (;) 
1
.gradient {
	background-image: linear-gradient(angle, color1, color2) // angle: 90deg,  color1: red, color2:darkred
}
7
\\code for a basic gradient background
   #grad {
  background-image: linear-gradient(red, yellow);
}  
12

   #grad {
  background-image: linear-gradient(red, yellow);
}  
1
#gradient {
  background-image: linear-gradient(180deg, black, red);
}
/* can be applied in many places, as your <body> background or a <div> etc */ 
1
/*From bottom to top*/
background: rgb(166,166,166);
background: linear-gradient(0deg, rgba(166,166,166,1) 0%, rgba(255,255,255,1) 29%);
0

New to Communities?

Join the community