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.
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



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: 0pxat 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).
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):
<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 / property | Default | Effect |
|---|---|---|
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
.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.