I'm trying to change the texts with an animation but I still can't figure out how to do it. I have the following code:
.blink_me {
animation: blinker 1s linear infinite;
}
@keyframes blinker {
50% {
opacity: 0;
}
}
<p>Here is a sentence <span class="blink_me" id="rotate">default</span> is what changes</p>
<ul style="display:none">
<li>test1</li>
<li>bob</li>
<li>next</li>
<li>last</li>
<li>PABLO</li>
<li>ANDRES</li>
</ul>
The idea is that the elements of the label are displayed li
and change something like this: FadeIn Animation but using onlyCSS
You can have two animations:
You can have the text in several
span
inside and then show/hide by changing its width from 0 to auto (having aoverflow: hidden
). So what you would do is calculate the times (you have 6 different words, if the animation lasts 100% of the time, each word should be 16.6%).Then the only thing left would be to adjust the timing of the animations so that the blinking coincides with the word change.
Here you can see it working: