DistortionPremium

Prismatic Text

A word sliced into three bands: the red top one and the cyan bottom one slide in opposite directions ten times a second, the middle one never moves. CSS only.

CSSTextGlitch

Updated

This effect is part of Effect.Labs — 846 vanilla effects, some free, some premium. Distortion has 31 effects, including 5 free. Explore the category →

3 usage examples

3, 2, 1 countdown before a round — browser rhythm game — Prismatic Text example 1

① 3, 2, 1 countdown before a round — browser rhythm game

WhenIn Tocavel, round 2 is about to start: the digit fills the middle of the screen, above the four lanes and the D F J K keys, then gives way to “GO!”. The player stares at it for three seconds.
WhyThe shake gives the digit the nerves of a start without making it unreadable: the still middle band carries the reading. The effect lasts as long as the countdown, not the whole game.
Settings--prsm-size: 150px, --prsm-shift: 5px, --prsm-speed: .12s, --prsm-top: #ff2d6f, --prsm-bottom: #22e3ff, --prsm-bg: transparent, --prsm-height: auto. The scene script replaces the digit in the element and in data-text; in the capture it moves one step every four pointer moves.
Riso print studio name in the navigation column — the ink registration moves on hover — Prismatic Text example 2

② Riso print studio name in the navigation column — the ink registration moves on hover

WhenOn the Kalmire studio site, the name is written in fluorescent pink, black and blue in the block that leads back to the home page, left of the posters of the month. It stays still; it starts sliding when the mouse or the Tab key reaches that link.
WhyTwo inks that do not quite line up are the signature of riso printing: the two shifting bands replay it at logo size. Kept for hover, the motion flags the link without stirring the page all the time.
Settings--prsm-size: 31px, --prsm-color: #1f1d1a, --prsm-top: #ff48b0, --prsm-bottom: #0078bf, --prsm-speed: .16s, --prsm-shift: 0px at rest then 3px in an a:hover / a:focus-visible rule written by the scene; serif font inherited from the page.
Highlighted word in the headline of a piece on optical illusions — science magazine — Prismatic Text example 3

③ Highlighted word in the headline of a piece on optical illusions — science magazine

WhenIn Syrinelle magazine, the headline “Why your brain sometimes sees double” runs over three lines; only the last word is prismatic, at the size and in the typeface of the rest of the headline.
WhyThe word shows what the article explains: two pictures that do not quite overlap. Limited to one word, the effect draws the eye to the subject and leaves the standfirst to be read in peace.
SettingsWrapper written as a <span> inside the <h2>, with display: inline-flex; width: auto added by the scene; --prsm-size: 1em, --prsm-height: auto, --prsm-bg: transparent, --prsm-color: #16181d, --prsm-top: #e11d48, --prsm-bottom: #0891b2, --prsm-speed: .14s.

How it works

The word is written in .prsm-text and repeated in its data-text attribute. Two pseudo-elements copy it with content: attr(data-text) and sit exactly on top of it. Each is cut by clip-path: ::before keeps only the top 33%, painted in --prsm-top (red), ::after the bottom 33%, painted in --prsm-bottom (cyan). Between them you see the real text in its own colour.

A single animation, prsmShift, pushes a band --prsm-shift (2 px) to the left, brings it back, then pushes it as far to the right, in --prsm-speed (0.1 s). The bottom band plays the same animation backwards (reverse): when the top goes left, the bottom goes right. Measured: from −2 to +2 px, always opposed. The middle band is not animated, and that is what keeps the word readable.

The .fx-0263-root wrapper centres the word in a 300 px tall block with a near-black background. Both can be set: --prsm-height: auto shrinks the block to the text height, --prsm-bg: transparent lets your page show through. No JavaScript: the motion starts on display and needs no gesture.

Accessibility

  • Screen readers: the coloured bands are declared with an empty alternative text (content: attr(data-text) / ""). Accessibility tree read in Chromium 149: the word appears once. That syntax needs Chrome 77, Firefox 128 or Safari 17.4; below that the browser keeps the earlier declaration and a screen reader may repeat the word.
  • Continuous motion: the sliding never stops and the code has no Pause button. For a heading that stays on screen for long, set --prsm-shift: 0px at rest and give it its value back on hover and focus, as in the print studio example.
  • Flashing: only the edges of the letters change. Area that differs between the two extreme positions, counted on Chromium screenshots: about 510 px² at the original size, 2,000 px² for a 150 px digit with a 5 px shift, 7,800 px² at 12rem with 8 px. The WCAG 2.3.1 threshold is 21,824 px².
  • Visitors who limit animation: with prefers-reduced-motion: reduce, both bands stay put. The word remains three-coloured, red on top, cyan at the bottom, without any shake.
  • Keyboard and touch: nothing to activate, the block is neither a link nor a button. If you wrap it in an <a>, that link takes the focus; plan its outline, the code does not draw one.

Browser compatibility

1.9 KB of CSS, zero script. The slicing relies on clip-path: polygon() applied to pseudo-elements, the settings on CSS variables read inside keyframes with calc(). Checked on 4 December 2026 in Chromium 149, Firefox 151 and WebKit 26.5: bands at 0–33% and 67–100%, opposed 2 px shifts, two blocks on one page without interference, wrapper set inline inside a heading (height unchanged).

Chrome 74+✓ Full (measured on Chromium 149)
Firefox 63+✓ Full (measured on Firefox 151)
Safari 10.1+✓ WebKit 26.5 engine measured, real Safari not verified
Edge 79+✓ Full (Chromium engine)
iOS Safari 10.3+✓ Not verified on a device
Android Chrome 74+✓ Not verified on a device (Chromium engine)

The minimum versions are those of prefers-reduced-motion (MDN data); clip-path: polygon() and CSS variables are older. In a browser that ignores clip-path, the two copies would not be cut and the cyan copy would cover the whole word: it would stay readable, in a single colour.

The code

HTML structure to paste into your page (the CSS + JS come with your purchase):

index.html — structure
<div class="fx-0263-root">
  <div class="prsm-text" data-text="PRISM">PRISM</div>
</div>

One-time payment, no subscription — the code is yours forever

Customize

Options passed to the API or data-* attributes:

Option / propertyDefaultEffect
Text (HTML — content of .prsm-text and data-text) PRISM Write the same word in both places. A short word on a single line gives the cleanest bands.
--prsm-size 3rem Word size. The text does not shrink by itself: for a long word, give it a flexible size such as clamp(2rem, 9vw, 5rem).
--prsm-top · --prsm-bottom red · #0ff Colour of the top band and of the bottom band. Two shades from your brand are enough to change the mood entirely (printer's pink and blue, for instance).
--prsm-color #fff Colour of the word itself, visible in the middle band. Darken it on a light page.
--prsm-shift 2px Distance travelled on each side. 0px freezes the word in three colours; beyond 6 px on a large heading, reading gets tiring.
--prsm-speed .1s Duration of one back-and-forth. 0.3s gives a slow, almost mechanical sway.
--prsm-bg · --prsm-height #0a0a0f · 300px Background and minimum height of the block. transparent and auto to slip the word into an existing layout.

FAQ

In RGB Split, two whole copies of the word go behind it and stick out on each side: every letter has a red fringe on the left and a cyan one on the right, shaking diagonally. Here the copies are in front, cut into horizontal bands that slide against each other, and the middle third stays fixed. When stopped, RGB Split keeps its fringes; Prismatic Text becomes a word in three neatly stacked colours.
That is not what it is for. The cuts at 33% and 67% are computed on the height of the whole block: the red band does not follow each line, it covers the top of the whole block (checked on a five-line heading: the first line and half of the second are coloured, the middle ones stay bare). Keep to one word or one line, and leave the rest of the heading as plain text, as in the magazine example.
Write the wrapper and .prsm-text as <span> elements, then add display: inline-flex; width: auto on the wrapper with --prsm-size: 1em, --prsm-height: auto and --prsm-bg: transparent. Compared with a plain <span> in the three engines: same heading height, same word position within one pixel.