Day 25: CSS Chapter 4: layout: linear gradind
.grid{
width: 500px;
height: 500px;
background-image: linear-grading(red, yellow);
}
.grid{
width: 500px;
height: 500px;
background-image: linear-grading(to right, red, yellow);
}
1. Linear gradient :
The linear gradient is one of the most common and practical types of gradient (). You can choose to have the gradient's "axis" run from left to right, top to bottom, or at any angle.
- Syntax
background-image : linear-gradient(direction of gradient or angle(in degrees), color-stop1, color-stop2,….)
- Color stop meaning :
Color stops are places in a gradient that shows a certain color at the precise spot we choose. So they enable us to produce more detailed gradient effects.
- Example
The following code will create a linear gradient transitioning from yellow to green color towards the bottom.
- Code :
- Output :
- Example
The following code will create a linear gradient having 3 color stops, transitioning from blue to purple to red in a diagonal direction.
- Code :
- Output :
Comments
Post a Comment