The word tears along a horizontal line and the two halves jump sideways, then snap back together. Two clip-path halves of the same text move apart, so there is never a doubled copy.
Also known as: glitch text tear, clip path glitch, sliced text css.
<div class="txt-slice-glitch" data-text="BROKEN">BROKEN</div>
.txt-slice-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;
color: transparent;
letter-spacing: 0.05em;}
.txt-slice-glitch::before,
.txt-slice-glitch::after {
content: attr(data-text);
position: absolute;
inset: 0;
color: var(--c);
animation: 3s steps(1, end) infinite;
}
.txt-slice-glitch::before {
clip-path: inset(0 0 50% 0);
animation-name: txt-slice-glitch-top;
}
.txt-slice-glitch::after {
clip-path: inset(50% 0 0 0);
animation-name: txt-slice-glitch-bottom;
}
/* the two halves always share one cut line */
@keyframes txt-slice-glitch-top {
0%, 36%, 48%, 78%, 86%, 100% { clip-path: inset(0 0 50% 0); transform: none; }
38% { clip-path: inset(0 0 62% 0); transform: translateX(-0.14em); }
41% { clip-path: inset(0 0 30% 0); transform: translateX(0.08em); }
44% { clip-path: inset(0 0 55% 0); transform: translateX(-0.05em); }
80% { clip-path: inset(0 0 70% 0); transform: translateX(0.18em); }
83% { clip-path: inset(0 0 45% 0); transform: translateX(-0.06em); }
}
@keyframes txt-slice-glitch-bottom {
0%, 36%, 48%, 78%, 86%, 100% { clip-path: inset(50% 0 0 0); transform: none; }
38% { clip-path: inset(38% 0 0 0); transform: translateX(0.06em); }
41% { clip-path: inset(70% 0 0 0); transform: translateX(-0.1em); }
44% { clip-path: inset(45% 0 0 0); transform: translateX(0.03em); }
80% { clip-path: inset(30% 0 0 0); transform: translateX(-0.05em); }
83% { clip-path: inset(55% 0 0 0); transform: translateX(0.1em); }
}
@media (prefers-reduced-motion: reduce) {
.txt-slice-glitch, .txt-slice-glitch *, .txt-slice-glitch::before, .txt-slice-glitch::after, .txt-slice-glitch *::before, .txt-slice-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.