You have the ability to utilize CSS Gradients in order to achieve a similar effect.
The following code snippet demonstrates how you can generate a linear gradient
(from left to right) featuring rainbow colors on a div element:
<!DOCTYPE html>
<html>
<head>
<style>
#gradent-div {
width: 100%;
height: 100px;
background-image: linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet);
}
</style>
</head>
<body>
<div id="gradent-div">
</div>
</body>
</html>
If your aim is to apply a linear gradient to text, you can make use of webkit properties; setting -webkit-text-fill-color
will render the entire gradient-background transparent while -webkit-background-clip
will fill the text with the gradient background.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content=
"width=device-width, initial-scale=1.0" />
<title>Gradient Text</title>
<style>
body {
background: black;
}
h1 {
position: absolute;
top: 50%;
left: 50%;
font-size: 30px;
background: linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet);
-webkit-text-fill-color: transparent;
-webkit-background-clip: text;
}
</style>
</head>
<body>
<h1>This is for Text</h1>
</body>
</html>
PS - (Be mindful when selecting your background color)