GIVING TEXT SUPERPOWERS WITH CSS.
Every website must contain writings about whatever they are about. In creating websites, a frontend deeveloper has to tweak texts to give an appealing look with CSS.Animating text gradients with css
Gradients are way of combining two or more colors together, through progressive transitions i.e when two colors are combined, they are not combined in equal ratios, they mix fade into their colors progressively.An example of equal ratio,

An example of progressive transitions (gradients)

Steps in animating text gradient
i. Add the background property in your desired selector, and determine the type of gradient you would like to use.you can view types of gradients and their examples here For this article i will be using a background property called linear-gradient.
Select two or more colors you want to work with, and add them.
The resulting code should look like
Code:
.selector{
background: linear-gradient(#6bc5f8, #cf59e6);
}
For example, to top, to bottom, to top right, to top left, to bottom left
You can also specify the directions in angles.
Here is the format ;
Code:
.selector{
background: linear-gradient((DIRECTION), (Color1), (Color2), ... (Color-n))
}
The resulting code should be
Code:
.selector{
background: linear-gradient( -46deg, #6bc5f8, #cf59e6);
}
This CSS property is not accepted by all browsers, so we have to add another property to make it function properly on most browsers.
The resulting code once again would look like this:
Code:
.selector{
background: linear-gradient( -46deg, #6bc5f8, #cf59e6);
background-clip: text;
background size: 400% 400%;
-webkit-background-clip: text;
}
This gives:
Code:
.selector{
background: linear-gradient( -46deg, #6bc5f8, #cf59e6);
background-clip: text;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
You have to know that text gradients are not animatable with CSS, so animating it would be a matter of adding some tricks (Why not, we are in Evil Souls)
ANIMATING THE TEXT GRADIENT.
Steps:i. Like all animations in CSS, you will have to give your selector the animation property, which includes animation name, animation-duration, animatio-iteration-count(This is a property that determines how many times the animation will run. We are writing code for a text gradient so the animation should run infinitely.), animation-timing-function
The resulting code will be
Code:
.selector{
background: linear-gradient( -46deg, #6bc5f8, #cf59e6);
background-clip: text;
-webkit-background-clip: text;
color: transparent;
animation: textGradient;
animation-duration: 2s,
animation-iteration-count: infinite;
animation-timing-function: ease;
}
Step ii.
We go ahead to create keyframes (In case you don't know, keyframes are how animations are written in CSS. Here is a Link to read about it)Read carefully from here on.
The trick to successfully animating a text gradient is changing their background positions.
this CSS property sets the initial position for each background. and the position is relative to its layer.
Read about background property here
This would be the final Code for the keyframes animations
Code:
@keyframes Textgradient {
0% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
100% {
background-position: 0% 50%;
}
}
Code:
0%{
background-position: 0% 50%
}
Code:
50% {
background-position: 100% 50%;
}
Code:
100% {
background-position: 0% 50%;
}
With this, you have successfully animated a text gradient
Please comment on any questions you have, and i will try answering them as best as i can.
I don't hide content but I also deserve a comment
Happy Coding!