Most "RGB split" tutorials in CSS stack a red and cyan text-shadow behind white text. It looks painted on, and when the channels overlap, the colors turn muddy instead of bright. Real optical chromatic aberration splits light: red, green, and blue channels that add back up to pure white when they line up.
In CSS, you get real light addition with one rule: mix-blend-mode: screen. Here is how to build true RGB channel splitting for dark backgrounds, why it disappears on white pages (and the CMYK multiply fix), and the checklist for every time mix-blend-mode refuses to work.
The quick answer
Make the element itself pure green (#0f0), duplicate it into two pseudo-elements in pure red (#f00) and pure blue (#00f), and blend them with mix-blend-mode: screen:
.rgb {
position: relative;
display: inline-block;
isolation: isolate;
color: #00ff00; /* green channel */
}
.rgb::before,
.rgb::after {
content: attr(data-text);
position: absolute;
inset: 0;
mix-blend-mode: screen; /* R + G + B = pure white */
pointer-events: none;
}
.rgb::before { color: #ff0000; transform: translateX(-3px); }
.rgb::after { color: #0000ff; transform: translateX(3px); }
Compare real screen channels against the classic text-shadow shortcut:
Where all three channels overlap, #f00 + #0f0 + #00f equals #fff. Where only two overlap, you automatically get clean yellow (R+G), cyan (G+B), and magenta (R+B) fringes — just like a real lens or CRT phosphor mask.
How mix-blend-mode: screen adds light
screen is the digital equivalent of aiming three projectors at the same dark wall. Mathematically, for each color channel (0 to 1), the browser computes 1 - (1 - a) * (1 - b).
- Black (
0) is invisible: anything screened over black stays unchanged. - Pure red (
1, 0, 0) + pure green (0, 1, 0) + pure blue (0, 0, 1) = pure white (1, 1, 1). - At rest (
translateX(0)), the word is indistinguishable from normal white typography. The moment the layers drift apart, the spectrum appears out of nowhere.
This is the exact mechanism behind Chromatic Wave — driven by an @property clock and a damped sine wave so the split settles smoothly instead of snapping:
Why RGB split disappears on a white background (and the CMYK fix)
If you drop mix-blend-mode: screen onto a white page, the effect vanishes completely. Because screen only adds light, adding anything to #fff still equals #fff — pure white cannot get any brighter.
On light themes, flip from additive light (RGB + screen) to subtractive ink (CMYK + multiply):
.cmyk {
position: relative;
display: inline-block;
isolation: isolate;
color: #00ffff; /* cyan */
}
.cmyk::before,
.cmyk::after {
content: attr(data-text);
position: absolute;
inset: 0;
mix-blend-mode: multiply; /* C * M * Y = black */
pointer-events: none;
}
.cmyk::before { color: #ff00ff; transform: translateX(-3px); } /* magenta */
.cmyk::after { color: #ffff00; transform: translateX(3px); } /* yellow */
Here is why multiply works on paper-white backgrounds:
Use RGB + screen on dark backgrounds (#000–#1a1a1f) and CMY + multiply on light backgrounds (#eee–#fff).
Why isolation: isolate matters
Without isolation: isolate on the parent heading, the pseudo-elements do not just blend with the green text — they also blend with whatever sits behind the heading (a hero gradient, a card background, or a photo). That turns your white text pastel or washes out the red and blue edges.
isolation: isolate creates a fresh stacking context so screen (or multiply) stays strictly inside the text element:
Real RGB split on images and glitch slices
The same channel-addition idea works beyond plain headings:
- On images: stack three copies of the photo, filter each into a single channel with
background-blend-mode: multiplyover#f00/#0f0/#00f, then recombine the three layers withmix-blend-mode: screen. When you shift one layer on:hover, the photo splits into true optical channels without muddyhue-rotate()artifacts. - With torn slices: combine
mix-blend-mode: screenwithclip-path: inset()strips so the split only fires during a brief horizontal tear.
See both live and tweak their sliders:
Checklist: why mix-blend-mode is not working
When mix-blend-mode: screen appears to do nothing, it is almost always one of these five causes:
- The background is too light.
screenon white or light gray produces white. Switch tomultiplywith#0ff/#f0f/#ff0. - A parent broke the stacking context.
opacity < 1,filter,transform, orz-indexon a positioned wrapper creates a new stacking context, and blending stops at its edge.overflow: hiddenalone does not. Putisolation: isolatedirectly on the text element itself — not on a wrapper around only one pseudo-element. - Missing
data-textattribute.content: attr(data-text)renders nothing if the HTML attribute is missing or misspelled. - Pseudo-elements do not line up. Make sure the parent has
position: relativeand the pseudo-elements haveposition: absolute; inset: 0;with identical font, line-height, and letter-spacing. - Text wraps to two lines.
content: attr(data-text)on a multi-line heading can wrap differently if the parent width is tight. Keep RGB headings to a single line or set an explicitmax-widthandtext-align.
Accessibility
Give screen readers one clean word (CSS ::before and ::after with content can be read aloud in some browser/screen-reader pairs, so use empty alt text syntax content: attr(data-text) / "" where supported) and turn off channel motion for people who prefer reduced motion:
.rgb::before,
.rgb::after {
content: attr(data-text);
content: attr(data-text) / ""; /* hides duplicate text from screen readers */
}
@media (prefers-reduced-motion: reduce) {
.rgb::before,
.rgb::after {
animation: none;
transform: none;
}
}
FAQ
How do I do an RGB split in CSS without JavaScript?
Set the text color to #00ff00, add ::before (#ff0000) and ::after (#0000ff) with content: attr(data-text), position: absolute; inset: 0;, and mix-blend-mode: screen, then offset them by a few pixels with transform: translateX().
Why is my RGB split invisible on a white background?
mix-blend-mode: screen adds light, and white is already maximum brightness. On light backgrounds, switch to mix-blend-mode: multiply using cyan (#0ff), magenta (#f0f), and yellow (#ff0) so the overlap forms crisp black text.
Should I use CSS layers or an SVG filter for RGB split?
Use CSS mix-blend-mode: screen for headings and short text: the text stays selectable, crisp at any zoom, and easy to animate with @property or CSS variables. Use an SVG filter (feColorMatrix + feOffset) when you need to split an arbitrary container, icon, or <video> without duplicating HTML.
Is mix-blend-mode: screen supported in all browsers?
Yes. mix-blend-mode and isolation: isolate have full support in Chrome, Edge, Safari, and Firefox (desktop and mobile).