Interlaced text with a solid, displaced strip rolling down it like interference on an old monitor. The stripes are a repeating gradient clipped to the text; the strip is a clip-path copy.
Also known as: scan line text effect, interlaced text css, screen interference text.
<div class="txt-scanline-glitch" data-text="OFFLINE">OFFLINE</div>
.txt-scanline-glitch {
--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-block;
letter-spacing: 0.08em;
background: repeating-linear-gradient(180deg, var(--c) 0 0.06em, color-mix(in srgb, var(--c) 50%, transparent) 0.06em 0.1em);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
-webkit-text-fill-color: transparent;
animation: txt-scanline-glitch-roll 0.8s linear infinite;}
.txt-scanline-glitch::after {
content: attr(data-text);
position: absolute;
inset: 0;
color: var(--c);
-webkit-text-fill-color: var(--c);
text-shadow: -0.04em 0 #ff2d78, 0.04em 0 #00c2ff;
clip-path: inset(0 0 100% 0);
animation:
txt-scanline-glitch-band 2.4s cubic-bezier(0.45, 0, 0.55, 1) infinite,
txt-scanline-glitch-jitter 0.24s steps(1, end) infinite;
}
@keyframes txt-scanline-glitch-roll {
to { background-position: 0 0.1em; }
}
@keyframes txt-scanline-glitch-band {
0% { clip-path: inset(0 0 100% 0); }
8% { clip-path: inset(0 0 78% 0); }
62% { clip-path: inset(78% 0 0 0); }
70%, 100% { clip-path: inset(100% 0 0 0); }
}
@keyframes txt-scanline-glitch-jitter {
0%, 100% { transform: translateX(0.07em); }
33% { transform: translateX(-0.05em); }
66% { transform: translateX(0.12em); }
}
@media (prefers-reduced-motion: reduce) {
.txt-scanline-glitch, .txt-scanline-glitch *, .txt-scanline-glitch::before, .txt-scanline-glitch::after, .txt-scanline-glitch *::before, .txt-scanline-glitch *::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.