I have a demo. It's a simple React
app where I'm displaying an array of text. I'd like to loop through the array and hide and show the text. I thought I might be able to do this in React
but I think now it might have to be with CSS
. I can hide and show the first color but how can I loop through the colors so it would show Red then Green and etc.
*{
font-family: Lato;
}
@keyframes fade-animation {
0% {
opacity: 0;
}
20% {
opacity: 0;
}
40% {
opacity: 1;
}
60% {
opacity: 1;
}
80% {
opacity: 1;
}
100% {
opacity: 0;
}
}
.titles{
position: relative;
text-align: center;
}
.titles p{
font-size: 40px;
position: absolute;
opacity: 0;
}
.titles p:nth-child(1) {
animation: fade-animation 5s linear 0s infinite;
}
/* .titles p:nth-child(2) {
animation: fade-animation 5s linear 15s infinite;
} */