Chunky letters hop in a wave at the choppy frame rate of an old console, each over a hard pixel shadow. steps() on the hop gives the low frame count, and the shadow has no blur at all.
Also known as: 8 bit text effect css, retro game text, pixel art text bounce.
<div class="txt-pixel-text-bounce" aria-label="LEVEL UP!"><span style="--i: 0">L</span><span style="--i: 1">E</span><span style="--i: 2">V</span><span style="--i: 3">E</span><span style="--i: 4">L</span><span style="--i: 5"> </span><span style="--i: 6">U</span><span style="--i: 7">P</span><span style="--i: 8">!</span></div>
.txt-pixel-text-bounce {
--c: var(--txt-color, #3b82f6);
font-size: var(--txt-size, 32px);
font-family: system-ui, sans-serif;
font-weight: 700;
line-height: 1.2;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-weight: 800;
letter-spacing: 0.04em;
color: var(--c);
text-shadow: 0.08em 0.08em 0 color-mix(in srgb, var(--c) 40%, #000);
-webkit-font-smoothing: none;}
.txt-pixel-text-bounce span {
display: inline-block;
animation: txt-pixel-text-bounce-hop 1.2s steps(3, end) infinite;
animation-delay: calc(var(--i) * 0.1s);
}
@keyframes txt-pixel-text-bounce-hop {
0%, 30%, 100% { transform: translateY(0); }
15% { transform: translateY(-0.36em); }
}
@media (prefers-reduced-motion: reduce) {
.txt-pixel-text-bounce, .txt-pixel-text-bounce *, .txt-pixel-text-bounce::before, .txt-pixel-text-bounce::after, .txt-pixel-text-bounce *::before, .txt-pixel-text-bounce *::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.