Menu

Real RGB Split in CSS with mix-blend-mode: screen
πŸ“°

Real RGB Split in CSS with mix-blend-mode: screen

DEV Community: cssΒ·glitch.ezolabΒ·1 day ago
#SqQHkQ5g
#devtocss#devto#dev#white#transform
Long article (976 words) β€” no AI summary yet.
Reading 0:00
15s threshold

Many CSS "RGB split" effects put red and cyan text-shadow copies behind white text. They look like colored outlines, because nothing is actually being split.

Real chromatic aberration separates light . Red, green and blue add up to white where they line up, and color appears only where they don't. One CSS property gives you that: mix-blend-mode: screen .

The short version

Make the text pure green, add a red and a blue copy, and blend both with screen :

<span class = "rgb" data-text = "SIGNAL" > SIGNAL </span>

Enter fullscreen mode

Exit fullscreen mode

.rgb { position : relative ; display : inline-block ; isolation : isolate ; color : #0f0 ; /* green channel */ }

.rgb : : before , .rgb : : after { content : attr ( data-text ) ; position : absolute ; inset : 0 ; mix-blend-mode : screen ; /* R + G + B = white */ pointer-events : none ; }

.rgb : : before { color : #f00 ; transform : translateX ( -3px ) ; } .rgb : : after { color : #00f ; transform : translateX ( 3px ) ; }

Enter fullscreen mode

Exit…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.