I'm interested in creating an animation that cycles between "0% interest free credit" and "free delivery". I am attempting to achieve this without the use of JavaScript, but so far I can only make the first element fade away without the second one fading in.
.parent {
position: relative;
}
.parent p {
position: absolute;
top: 0;
left: 0;
}
.parent p:first-child {
animation: hide 2s ease-in
}
.parent p:last-child {
opacity: 0;
animation: show 2s ease-in animation-delay:2s;
}
@keyframes show {
to {
opacity: 1;
}
}
@keyframes hide {
to {
opacity: 0;
}
}
<div class="parent">
<p>0% interest free credit</p>
<p>free delivery</p>
</div>
What could be causing my issue? I want one element to fade out while the other fades in, and I want this to loop endlessly.