Each letter rises and fades in a beat after the previous one. Every span carries its index in a custom property, so the delay is one calc() and adding letters needs no new CSS.
Also known as: staggered letter animation, split text reveal, letter by letter.
<div class="txt-letters-rise" aria-label="Welcome!"><span style="--i: 0">W</span><span style="--i: 1">e</span><span style="--i: 2">l</span><span style="--i: 3">c</span><span style="--i: 4">o</span><span style="--i: 5">m</span><span style="--i: 6">e</span><span style="--i: 7">!</span></div>
.txt-letters-rise {
--c: var(--txt-color, #3b82f6);
font-size: var(--txt-size, 32px);
font-family: system-ui, sans-serif;
font-weight: 700;
line-height: 1.2;
color: var(--c);}
.txt-letters-rise span {
display: inline-block;
opacity: 0;
animation: txt-letters-rise-up 0.5s ease-out forwards;
animation-delay: calc(var(--i) * 60ms);
}
@keyframes txt-letters-rise-up {
from { opacity: 0; transform: translateY(0.6em); }
to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
.txt-letters-rise, .txt-letters-rise *, .txt-letters-rise::before, .txt-letters-rise::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}--txt-color on the element or a parent.
Currently previewing #3b82f6.--txt-size. Every other dimension is in
em, so the whole thing scales together. Currently previewing 40px.transition or animation
shorthand. Staggered delays are relative, so they keep their rhythm.