I wonder if there is a simple CSS solution to make an animation delay depending on the count of elements. I've tried something like this.
/* fade in from left */
@keyframes myAnimation {
0% {
opacity: 0;
transform: translateX(-20px)
}
100% {
opacity: 1;
transform: translateX(0);
}
}
ul {
counter-reset: items;
}
li {
counter-increment: items;
animation: myAnimation;
animation-delay: counter(items) * .2s;
}
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
</ul>
Does anyone have a solution which does not include javascript or multiple css classes?