3.1: Gradients
GRADIENTS
Gradients is defined as the smooth transition between two or more colors. Using gradients is an easy way to add depth and dimension.
There are 2 types of gradients:
Linear (goes down/up/left/right/diagonally)
Radial (defined by their center)
Linear Gradient
In order to create a linear gradient you need to choose at least two color-stops. Color-stops are the colors which you want to transition between. You can also choose which direction you want your colors to go.
Key Directional Phrases:
Example:
Using Angles:
If you would like more control over the direction of the gradient, you can define an angle, instead of using the predefined directions.
When using an angle, 0deg creates a vertical gradient running bottom to top, 90deg creates a horizontal gradient running left to right, and so on in a clockwise direction. Negative angles run in the counterclockwise direction.
In Module 2.0 we talked about colors and all the different ways we can achieve the same colors (Hex, RGBA and HSLA). Well we can use those same color codes here in gradients.
Example:
CHALLENGE: Using four different colors, two of your choice, create a linear gradiant in any shape of any size. Make sure it starts with red and ends with black. You must use Hex-code for the two colors of your choice.*
Radial Gradients
Radial gradients are similar to linear gradients except that they are circular or elliptical (default). Radial gradients define the center of the gradient, size, shape and color stops. Color stops start in the center and proceed outward
Example:
Again like linear gradients, you can position each radial color stop with a percentage or absolute length. Position: top, right, left, center, or top center, bottom left, keeping in mind that default is center.
Example:
Position: top, right, left, center, or top center, bottom left, default is center
Hard Color Stops
You don't have to leave your color stops at their default positions. To fine-tune their locations, you can give each one a percentage or absolute length value. They are useful for declaring a full-height background that simulates columns or stripes.
Example:
RESOURCES
TERMINOLOGY
alpha-channel: transparency
Last updated