Nearby lessons
12 of 15CSS: Gradient (Linear & Radial)
π What are CSS Gradients?
CSS gradients let you create smooth transitions between two or more specified colors without using images. There are mainly two types: linear-gradient and radial-gradient. You can control direction, color stops, and even create repeating patterns.
1οΈβ£ Linear Gradient β Top to Bottom
A basic linear-gradient transitions colors vertically from top to bottom by default.
Code Example
2οΈβ£ Linear Gradient β Directions
Use to right, to left, to top, to bottom right, etc., to control the direction of the gradient.
Code Example
3οΈβ£ Linear Gradient with Angle
You can specify angles (e.g., -45deg) to create diagonal gradients.
Code Example
4οΈβ£ Radial Gradient β Default
A radial-gradient radiates colors from the center outward in a circular or elliptical shape.
Code Example
5οΈβ£ Radial Gradient with Color Stops
You can define color stops with percentage values to control where colors start and end.
Code Example
6οΈβ£ Repeating Radial Gradient
Use repeating-radial-gradient to create repeated circular gradient patterns.