Red and cyan copies of the word sit behind it and snap out of register in hard steps, like a misaligned video signal. The copies read from a data attribute and only move with transform.
Also known as: chromatic aberration text, rgb glitch effect css, color split text.
<div class="txt-rgb-split-glitch" data-text="SIGNAL">SIGNAL</div>
.txt-rgb-split-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;
isolation: isolate;
color: var(--c);
letter-spacing: 0.06em;
animation: txt-rgb-split-glitch-shake 2.6s steps(1, end) infinite;}
.txt-rgb-split-glitch::before,
.txt-rgb-split-glitch::after {
content: attr(data-text);
position: absolute;
inset: 0;
z-index: -1;
animation: 2.6s steps(1, end) infinite;
}
.txt-rgb-split-glitch::before {
color: #ff2d78;
animation-name: txt-rgb-split-glitch-red;
}
.txt-rgb-split-glitch::after {
color: #00c2ff;
animation-name: txt-rgb-split-glitch-cyan;
}
@keyframes txt-rgb-split-glitch-red {
0%, 89%, 100% { transform: translate(-0.05em, 0); }
10% { transform: translate(-0.07em, 0.02em); }
14% { transform: translate(-0.02em, -0.01em); }
30% { transform: translate(-0.05em, 0); }
46% { transform: translate(-0.14em, 0.03em); }
49% { transform: translate(0.06em, -0.02em); }
52% { transform: translate(-0.05em, 0); }
74% { transform: translate(-0.03em, 0.01em); }
86% { transform: translate(-0.1em, -0.02em); }
}
@keyframes txt-rgb-split-glitch-cyan {
0%, 89%, 100% { transform: translate(0.05em, 0); }
10% { transform: translate(0.03em, -0.02em); }
14% { transform: translate(0.06em, 0.01em); }
30% { transform: translate(0.05em, 0); }
46% { transform: translate(0.12em, -0.03em); }
49% { transform: translate(-0.07em, 0.02em); }
52% { transform: translate(0.05em, 0); }
74% { transform: translate(0.05em, -0.01em); }
86% { transform: translate(0.09em, 0.02em); }
}
@keyframes txt-rgb-split-glitch-shake {
0%, 52%, 89%, 100% { transform: none; }
46% { transform: translateX(0.03em) skewX(-8deg); }
49% { transform: translateX(-0.03em); }
86% { transform: translateX(-0.02em) skewX(5deg); }
}
@media (prefers-reduced-motion: reduce) {
.txt-rgb-split-glitch, .txt-rgb-split-glitch *, .txt-rgb-split-glitch::before, .txt-rgb-split-glitch::after, .txt-rgb-split-glitch *::before, .txt-rgb-split-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.