About Lesson
1. Linear Gradients:
Syntax:
background: linear-gradient(direction, color-stop1, color-stop2, ...);
direction
(optional): Defines the direction of the gradient. It can be an angle (e.g.,45deg
) or keywords (to right
,to bottom left
, etc.).color-stop
: The color and its position in the gradient. If no position is specified, the colors are evenly spaced.
Example:
.linear-gradient
: Applies a linear gradient background from #ff7e5f
to #feb47b
.
CSS
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS Gradients Example</title>
<style>
.linear-gradient {
background: linear-gradient(to right, #ff7e5f, #feb47b);
width: 200px;
height: 200px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}
</style>
</head>
<body>
<div class="linear-gradient"></div>
</body>
</html>