Computer >> Computer tutorials >  >> Programming >> CSS

Creating Linear Gradients using Multiple Color Stops in CSS


To create a linear gradient using multiple color stops, the code is as follows −

Example

<!DOCTYPE html>
<html>
<head>
<style>
body {
   font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}
div {
   height: 200px;
   width: 100%;
   display: inline-block;
   margin-right: 10px;
}
.linearGradient {
   background-image: linear-gradient(to left, orange, blue,green,pink,yellow);
}
</style>
</head>
<body>
<h1>Linear Gradient direction using multiple color stops</h1>
<div class="linearGradient"></div>
</body>
</html>

Output

The above code will produce the following output −

Creating Linear Gradients using Multiple Color Stops in CSS