Letters arrive white hot, glowing in the accent color, and cool down to solid color a moment later, so the newest letters always burn brightest and the typing head leaves a fading trail.
Also known as: typing with glow trail, hot type animation, neon typing effect.
<div class="txt-glowing-typewriter-text" aria-label="Spark something"> <span aria-hidden="true"><span style="--i: 0">S</span><span style="--i: 1">p</span><span style="--i: 2">a</span><span style="--i: 3">r</span><span style="--i: 4">k</span><span style="--i: 5"> </span><span style="--i: 6">s</span><span style="--i: 7">o</span><span style="--i: 8">m</span><span style="--i: 9">e</span><span style="--i: 10">t</span><span style="--i: 11">h</span><span style="--i: 12">i</span><span style="--i: 13">n</span><span style="--i: 14">g</span></span> </div>
.txt-glowing-typewriter-text {
--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);
letter-spacing: 0.02em;}
.txt-glowing-typewriter-text span span {
animation: txt-glowing-typewriter-text-cool 1.1s cubic-bezier(0.2, 0.6, 0.3, 1) calc(0.3s + var(--i) * 75ms) both;
}
@keyframes txt-glowing-typewriter-text-cool {
0% {
opacity: 0;
color: color-mix(in srgb, var(--c) 30%, #fff);
text-shadow: 0 0 0.1em var(--c), 0 0 0.4em var(--c), 0 0 0.9em var(--c);
}
6% {
opacity: 1;
color: color-mix(in srgb, var(--c) 30%, #fff);
text-shadow: 0 0 0.1em var(--c), 0 0 0.4em var(--c), 0 0 0.9em var(--c);
}
100% {
opacity: 1;
color: var(--c);
text-shadow: 0 0 0 transparent, 0 0 0 transparent, 0 0 0 transparent;
}
}
@media (prefers-reduced-motion: reduce) {
.txt-glowing-typewriter-text, .txt-glowing-typewriter-text *, .txt-glowing-typewriter-text::before, .txt-glowing-typewriter-text::after, .txt-glowing-typewriter-text *::before, .txt-glowing-typewriter-text *::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.