A typing animation with zero JavaScript
Here's a small effect: a line of text types itself out one character at a time, waits a moment, deletes itself and is replaced by the next line, on a loop. It looks like this:
There's no JavaScript anywhere in it. There's no setInterval, no timer counting characters and nothing listening for events, just three lines of plain text and some CSS.
A box that grows
A typewriter effect looks like it's revealing letters one at a time, but the full sentence is there from the start. It sits in a box that starts at zero width, with overflow: hidden clipping anything past its edge. As the box's width animates from 0 to "wide enough for the whole sentence", more of the text shows, because there's more room for it.
The blinking cursor is a smaller trick: a solid border on the right edge of the same box, with its colour animated between visible and transparent on a fast, even loop.
Moving in steps
If you animate width from 0 to 13ch over a couple of seconds, the browser interpolates smoothly and the box eases open like a fade. That's the wrong shape. Real typing moves in jumps: one character appears, then nothing, then the next.
CSS has a timing function for exactly this. steps() makes the animation move in a fixed number of even jumps, one per character, so it lands on a value, holds it, and jumps to the next, which is what makes it look like typing.
Three lines sharing one clock
The hardest part was getting three lines to take turns with no script coordinating them. Each phrase gets its own looping animation, all with the same total duration, and each one is only visible and expanded during its slice of that shared timeline: the first third for line one, the middle third for line two, the last third for line three. Outside its slice a phrase sits collapsed and invisible.
Because they loop on identical timing, running all three at once makes them take turns. None of the lines knows about the others. Each one watches the same clock and acts on its own part of it.
Uses and limits
I'd use it for a loading state, a rotating "here's what this does" line, or a bit of personality on an otherwise static page, anywhere a small flourish isn't worth shipping JavaScript for. It also respects people who've asked their operating system for reduced motion, with a single prefers-reduced-motion media query. The demo above swaps to a still punchline for them.
The catch is that it only works because the text and its timing are known ahead of time. The widths and step counts are tuned to these exact phrases, so you can't hand it arbitrary text at runtime (for that you'd want JavaScript). For a few fixed lines you tune once and forget, that's fine.