Hot, glowing letters with small lightning bolts that crackle around them in quick double flashes. The bolts are inline SVG polylines, each flashing with steps() on its own delay.
Also known as: lightning text css, electric glow text, crackling text effect.
<div class="txt-electric-text">
<span class="txt-electric-text-word">VOLTAGE</span>
<svg class="txt-electric-text-bolts" viewBox="0 0 140 40" aria-hidden="true">
<polyline points="14,0 19,7 15,9 22,15 18,17 24,22" style="--d: 0s" />
<polyline points="44,40 41,33 46,31 40,26 44,24" style="--d: 0.15s" />
<polyline points="30,5 37,8 44,3 51,9 58,4" style="--d: 0.35s" />
<polyline points="72,0 68,6 73,8 67,14 71,16" style="--d: 0.5s" />
<polyline points="100,40 104,33 99,31 105,26 101,23" style="--d: 0.7s" />
<polyline points="126,1 121,7 126,9 119,15" style="--d: 0.85s" />
<polyline points="1,27 8,21 7,28 15,22" style="--d: 1s" />
<polyline points="139,15 132,19 134,12 126,17" style="--d: 1.2s" />
</svg>
</div>.txt-electric-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;
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
width: 7em;
height: 2em;
font-style: italic;
font-weight: 900;
letter-spacing: 0.06em;}
.txt-electric-text-word {
color: color-mix(in srgb, var(--c) 30%, #fff);
text-shadow: 0 0 0.01em var(--c), 0 0 0.03em var(--c), 0 0 0.1em var(--c), 0 0 0.3em color-mix(in srgb, var(--c) 70%, transparent), 0 0 0.6em color-mix(in srgb, var(--c) 40%, transparent);
animation: txt-electric-text-surge 1.4s steps(1, end) infinite;
}
.txt-electric-text-bolts {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
overflow: visible;
}
.txt-electric-text-bolts polyline {
fill: none;
stroke: color-mix(in srgb, var(--c) 45%, #fff);
stroke-width: 1.6;
stroke-linecap: round;
stroke-linejoin: round;
filter: drop-shadow(0 0 0.04em var(--c)) drop-shadow(0 0 0.1em var(--c));
opacity: 0;
animation: txt-electric-text-zap 1.4s steps(1, end) var(--d) infinite;
}
@keyframes txt-electric-text-zap {
0%, 12%, 100% { opacity: 0; }
2%, 8% { opacity: 1; }
5% { opacity: 0.25; }
}
@keyframes txt-electric-text-surge {
0%, 4%, 27%, 31%, 52%, 56%, 73%, 77%, 88%, 92%, 100% { transform: none; filter: none; }
2%, 29%, 54%, 75%, 90% { transform: translateX(0.015em); filter: brightness(1.3); }
}
@media (prefers-reduced-motion: reduce) {
.txt-electric-text, .txt-electric-text *, .txt-electric-text::before, .txt-electric-text::after, .txt-electric-text *::before, .txt-electric-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.