RGB Channel Split Glitch Headline

A dark hero headline whose red and cyan colour channels sit two pixels apart, like a slightly misaligned monitor, and tear into horizontal slices during two brief bursts in every cycle. Between bursts the type rests, so the line stays easy to read. It is pure CSS: two pseudo elements copy the text from a data attribute, and clip-path cuts the slices. On phones the headline wraps and the copies wrap with it.

Code

import { useEffect, useRef, useState } from "react";

const headline = "Static after midnight";

export default function RgbChannelSplitGlitchHeadline() {
  const root = useRef<HTMLElement>(null);
  const [visible, setVisible] = useState(true);

  useEffect(() => {
    const el = root.current;
    if (!el) return;
    const io = new IntersectionObserver(([entry]) => setVisible(entry.isIntersecting));
    io.observe(el);
    return () => io.disconnect();
  }, []);

  return (
    <section
      ref={root}
      data-paused={visible ? "false" : "true"}
      className="w10rgb relative overflow-hidden bg-[#0f1113] px-5 py-20 sm:px-10 sm:py-28"
    >
      <style>{`
        .w10rgb { --w10rgb-red: #ff4766; --w10rgb-cyan: #2fd3ff; --w10rgb-cycle: 4.6s; }
        .w10rgb-glow { background: radial-gradient(60% 55% at 50% 42%, rgba(70, 92, 110, 0.35), transparent 70%), radial-gradient(40% 40% at 80% 90%, rgba(255, 71, 102, 0.08), transparent 70%); }
        .w10rgb-lines { background: repeating-linear-gradient(to bottom, rgba(255,255,255,0.035) 0 1px, transparent 1px 3px); }
        .w10rgb-word { position: relative; display: inline-block; }
        .w10rgb-word::before, .w10rgb-word::after { content: attr(data-text); position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen; }
        .w10rgb-word::before { color: var(--w10rgb-red); transform: translate(-2px, 0); animation: w10rgb-red var(--w10rgb-cycle) steps(1, end) infinite; }
        .w10rgb-word::after { color: var(--w10rgb-cyan); transform: translate(2px, 0); animation: w10rgb-cyan var(--w10rgb-cycle) steps(1, end) infinite; }
        .w10rgb-shift { display: inline-block; animation: w10rgb-shift var(--w10rgb-cycle) steps(1, end) infinite; }
        @keyframes w10rgb-red {
          0% { clip-path: inset(0 0 0 0); transform: translate(-2px, 0); }
          3% { clip-path: inset(14% 0 62% 0); transform: translate(-11px, 0); }
          5% { clip-path: inset(61% 0 21% 0); transform: translate(8px, 0); }
          7% { clip-path: inset(36% 0 44% 0); transform: translate(-6px, 0); }
          9% { clip-path: inset(0 0 0 0); transform: translate(-2px, 0); }
          55% { clip-path: inset(72% 0 8% 0); transform: translate(12px, 0); }
          57% { clip-path: inset(0 0 0 0); transform: translate(-2px, 0); }
        }
        @keyframes w10rgb-cyan {
          0% { clip-path: inset(0 0 0 0); transform: translate(2px, 0); }
          3% { clip-path: inset(48% 0 30% 0); transform: translate(10px, 0); }
          5% { clip-path: inset(8% 0 74% 0); transform: translate(-9px, 0); }
          7% { clip-path: inset(66% 0 12% 0); transform: translate(5px, 0); }
          9% { clip-path: inset(0 0 0 0); transform: translate(2px, 0); }
          55% { clip-path: inset(20% 0 64% 0); transform: translate(-10px, 0); }
          57% { clip-path: inset(0 0 0 0); transform: translate(2px, 0); }
        }
        @keyframes w10rgb-shift {
          0% { transform: none; }
          4% { transform: translateX(3px) skewX(-4deg); }
          6% { transform: translateX(-2px); }
          8% { transform: none; }
        }
        .w10rgb[data-paused="true"] .w10rgb-word::before, .w10rgb[data-paused="true"] .w10rgb-word::after, .w10rgb[data-paused="true"] .w10rgb-shift { animation-play-state: paused; }
        @media (prefers-reduced-motion: reduce) {
          .w10rgb-word::before, .w10rgb-word::after, .w10rgb-shift { animation: none; }
        }
      `}</style>
      <div aria-hidden="true" className="w10rgb-glow pointer-events-none absolute inset-0" />
      <div aria-hidden="true" className="w10rgb-lines pointer-events-none absolute inset-0" />
      <div className="relative mx-auto max-w-5xl text-center">
        <p className="font-mono text-xs uppercase tracking-[0.3em] text-[#9aa6b0]">Nightshift Radio · 98.4 FM</p>
        <h1 className="mt-6 text-[clamp(44px,9vw,112px)] font-extrabold leading-[0.95] tracking-tight text-[#eeece6]">
          <span className="sr-only">{headline}</span>
          <span aria-hidden="true" className="w10rgb-shift">
            <span className="w10rgb-word" data-text={headline}>{headline}</span>
          </span>
        </h1>
        <p className="mx-auto mt-6 max-w-xl text-base leading-relaxed text-[#b9c1c8] sm:text-lg">
          Independent late-night radio from a converted bakery basement. New mixes every Friday from eleven.
        </p>
        <a
          href="#"
          className="mt-9 inline-flex h-12 items-center rounded-full bg-[#eeece6] px-7 text-sm font-semibold text-[#0f1113] transition hover:bg-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#2fd3ff] focus-visible:ring-offset-2 focus-visible:ring-offset-[#0f1113]"
        >
          Listen live
        </a>
      </div>
    </section>
  );
}

Install with one command: npx shadcn@latest add https://we.inc/r/rgb-channel-split-glitch-headline-with-slices.json

When to use it

  • A music, gaming or nightlife site wants one headline with an analogue, broadcast feel without turning the whole page into noise.
  • You need a glitch that reads clearly at rest, so a screenshot or a slow reader still sees clean words most of the time.
  • You want the effect without a script, because the headline sits in a static page or an email landing page with no build step.

How to customize it

  • Recolour the channels with `--w10rgb-red` and `--w10rgb-cyan`. Keep them roughly opposite on the colour wheel so the fringes stay distinct on a dark background.
  • Make the bursts rarer by raising `--w10rgb-cycle` from 4.6s to something like 8s. The burst length scales with it, so also move the 3% to 9% keyframes closer together if you want them to stay snappy.
  • Change the words in three places: the hidden `w10rgb-sr` span, the `data-text` attribute and the visible text inside `w10rgb-word`. The pseudo elements read `data-text`, so a mismatch leaves a ghost of the old words.
  • Move the slices by editing the `inset()` percentages. The first value is the cut from the top and the third the cut from the bottom, so `inset(40% 0 40% 0)` leaves a thin band through the middle.

Accessibility

  • Screen readers get the headline once from a visually hidden span; the visible copy and both coloured pseudo copies are marked `aria-hidden`, so the text is never read three times.
  • Each cycle has two bursts of under half a second, which keeps the flicker far below three flashes per second. With reduced motion turned on, the bursts stop and only the static two pixel split remains.
  • The animation pauses when the section scrolls out of view, and the button keeps a visible focus ring in the cyan accent.

Questions

How does a CSS glitch text effect work?

The text is drawn three times. The base copy is normal, and two pseudo elements repeat it from `content: attr(data-text)` in different colours. Animating `clip-path: inset()` shows only a horizontal band of each copy while `transform` pushes that band sideways, which looks like a torn video line.

Why use mix-blend-mode screen on the coloured copies?

Screen blending adds light, so where red and cyan overlap the off-white base they stay white and only the edges show colour. Without it, the top copy would hide the base text and the headline would turn cyan.

Is a glitch effect safe for people with photosensitive epilepsy?

It can be if it is brief and small. This one runs two short bursts per cycle and moves thin slices rather than flashing large bright areas, and it switches off completely for visitors who ask their system for less motion. Avoid speeding the cycle up to many bursts per second.

Can I use this on several lines of text?

Yes. The pseudo copies are positioned over the whole word box with `inset: 0`, so they wrap exactly like the base text. Very long paragraphs look busy, though, so keep it for a headline or a short label.

Does it work on a light background?

Screen blending only brightens, so on white the fringes disappear. For a light page switch the pseudo elements to `mix-blend-mode: multiply` and use darker channel colours such as a deep red and a teal.

Related: 112 CSS Text Effects and Hover Animations, CSS Animated Background Set: Gradient Mesh, Dot Grid Spotlight, Aurora and Grain.

More text effects or all free UI components. Build your site free to have a full site built around it.

More in Text Effects

Product

Who It's For

Features

Resources

Company

View Sitemap