Here's a variation on goodship11's answer, except allowing for a dynamic number of elements (to avoid the need to create a potentially infinite number of nth-child
css rules).
Dynamic version:
The example uses jQuery (so it's shorter) but it could just as easily done in plain ol' JavaScript (see the edit).
var i=0;
$('#myList li').each(function(){
this.style.setProperty('--n',i++);
})
li{opacity:0; animation:fadeIn 1s calc(var(--n)*1s) 1 forwards;}
@keyframes fadeIn{to{opacity:1}}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<ul id="myList">
<li>Thing 1</li>
<li>Thing 2</li>
<li>Thing 3</li>
<li>Thing 4</li>
<li>Thing 5</li>
</ul>
...or the loops could be written as a one-liner without the need for a variable, by instead using the element's index number:
$('#myList li').each(function(){this.style.setProperty('--n', Array.from($('#myList li')).indexOf(this))});
EDIT: while I'm at it, here's the "plain" JavaScript equivalent:
const lis=Array.from(myList.getElementsByTagName('li'));
for(var n=0; n<lis.length; n++){
lis[n].style.setProperty('--n', n);
}
li{opacity:0; animation:fadeIn 1s calc(var(--n)*1s) 1 forwards;}
@keyframes fadeIn{to{opacity:1}}
<ul id="myList">
<li>Thing 1</li>
<li>Thing 2</li>
<li>Thing 3</li>
<li>Thing 4</li>
<li>Thing 5</li>
</ul>