<!DOCTYPE html>
<html>
<head>
<style>
.gradient {
width: 300px;
height: 150px;
background: linear-gradient(to right, red, yellow);
text-align: center;
line-height: 150px;
font-weight: bold;
color: white;
}
</style>
</head>
<body>
<div class="gradient">Gradient Background</div>
</body>
</html>
Explanation:
linear-gradient(to right, red, yellow)creates a smooth color transition.- You can also use
to bottom,to left,to top right, etc.
Leave a Reply