Parallax Layers CSS
Four layers cover a 900 px tray — three glows, eight dots, a giant barely visible word, a sentence — and each climbs faster than the page: 100, 60, 110 and 45 px ahead over 620 px of scrolling. Nothing but vertical translations, two of them carrying text: typographic parallax in CSS alone.
Updated
This effect is part of Effect.Labs — 846 vanilla effects, some free, some premium. Scroll has 74 effects, including 12 free. Explore the category →
3 usage examples



How it works
The .sb-plxlayers-content tray (900 px, midnight-blue gradient) holds four children in position: absolute. Two cover it entirely (inset: 0): .sb-plxlayers-shapes, with three radial-gradient glows placed at 15, 50 and 75% of the height, and .sb-plxlayers-mid, a row of eight 8 and 12 px dots centred with flexbox. The other two are texts set at mid-width: .sb-plxlayers-back, a 35 px word in white at 12%, at 40% of the height, and .sb-plxlayers-front, a 14 px sentence, at 55%. Each gets its own animation, all on animation-timeline: scroll(): translateY from 40 to −60 px for the glows, 20 to −40 for the dots, 30 to −80 for the word, 15 to −30 for the sentence.
All four layers travel the same way as the content, only faster: none “lags” like a distant backdrop, they all behave as foreground. Read in Chromium 149 and WebKit 26.5, with identical values: after 100 px of scrolling the glows sit at +23.9 px, the dots at +10.3, the word at +12.3, the sentence at +7.7; at 260 px, −1.9, −5.2, −16.1 and −3.9; at the bottom, −60, −40, −80 and −30. So the word, which sits above, pulls away from the sentence: 120 px lie between them at the top of the travel, 185 at the bottom. What shows in the 280 px frame depends on where you are: a single glow at rest, the word from 77 to 348 px, the sentence from 207 to 482 px — both together for 141 px.
The original code did not move, in any browser. The tray was set to overflow: hidden, which makes it a scroll container; scroll() latches onto the nearest one, therefore onto it, and since it has nothing to scroll the timeline stays inactive — transform: none read on all four layers from one end to the other. overflow: clip crops in the same way without capturing the timeline, which then climbs up to the real scrolling area. Second fix: a text placed at left: 50% wraps as soon as it exceeds half the width; at 390 px the sentence sat on two 195 px lines, it now takes its 289 px on a single one (width: max-content, 90% at most).
Accessibility
- Reduced motion: under
prefers-reduced-motion: reducethe four animations are switched off (animation: none). Each layer stays at its base position — the word at 40%, the sentence at 55% — and scrolls with the page like ordinary content. Nothing is hidden: the parallax is an extra, it carries no information. - Text: the
.sb-plxlayers-frontsentence is read normally by screen readers; its white at 60% gives 6.7 to 7.2:1 depending on the spot in the gradient (computed). The giant word sits at 1.4:1: it is a motif, not a heading. It carriesaria-hidden="true", like the glows and the dots. If you put a real section title there, remove that attribute and raise its opacity — or back it with a readable heading. - Keyboard: the scrolling area takes focus (
tabindex="0", violet outline) and is browsed with the arrow keys; the layers then follow exactly as with the wheel. Recorded in all three engines; WebKit ignored the area before this addition. - Touch and small screens: with a finger the area scrolls natively (150 px swiped, 150 px recorded in touch emulation). At 390 px wide nothing sticks out of the frame and the sentence stays on one line. The word is 189 px wide and does not break: in a column narrower than that, lower
font-sizeor pick a shorter word.
Browser compatibility
No script. Two properties set the floor: animation-timeline: scroll() (Chrome and Edge 115, Safari 26, Firefox 159 according to MDN) and overflow: clip (Chrome 90, Firefox 81, Safari 16), always available when the first one is. The offsets read in Chromium 149 and WebKit 26.5 match to a tenth of a pixel. Firefox 151 animates nothing: the four layers stay at their base place, readable. Firefox 159 and a real Safari could not be tried.
The animations are locked inside an @supports (animation-timeline: scroll()) block. Elsewhere the layers keep their base transform: glows and dots in place, word and sentence centred at 40 and 55% of the tray. Before overflow: clip, the overflow: hidden line written just above keeps cropping.
The code
HTML structure to paste into your page (the CSS + JS come with your purchase):
<div class="fx-0548-root">
<div class="sdc-scroll-container" tabindex="0" role="region" aria-label="…">
<div class="sb-plxlayers-content">
<div class="sb-plxlayers-shapes" aria-hidden="true">
<div class="sb-plxlayers-circle sb-plxlayers-c1"></div>
… c2, c3
</div>
<div class="sb-plxlayers-mid" aria-hidden="true">
<div class="sb-plxlayers-dot"></div>
… ×8
</div>
<div class="sb-plxlayers-back" aria-hidden="true">…</div>
<div class="sb-plxlayers-front">…</div>
</div>
</div>
<span class="sdc-scroll-hint" aria-hidden="true">…</span>
</div>
One-time payment, no subscription — the code is yours forever
Customize
Options passed to the API or data-* attributes:
| Option / property | Default | Effect |
|---|---|---|
Amplitudes (CSS — @keyframes fx0548Shapes, Mid, Back, Front) |
40 → −60, 20 → −40, 30 → −80, 15 → −30 px | The gap between the start and end value sets the layer's speed. Flip the signs (for instance −40 → 60) and the layer climbs slower than the page: it drops to the background. |
Tray height (CSS — .sb-plxlayers-content { height: 900px }) |
900 px, i.e. 620 px of travel | Amplitudes are in pixels: on a shorter tray the same shift happens over less scrolling and the parallax looks stronger; on a 4,000 px page it becomes almost imperceptible. |
Giant word (HTML + CSS — .sb-plxlayers-back) |
“PARALLAX”, 35 px, white at 12%, at 40% | Go up to 120 or 160 px for a true typographic backdrop; keep opacity under 20% while a text passes in front. |
Sentence (HTML + CSS — .sb-plxlayers-front) |
14 px, white at 60%, at 55%, 90% wide at most | It is the slowest layer (45 px): the most comfortable to read in motion. Change top to bring it closer to the word. |
Glows and dots (CSS — .sb-plxlayers-c1 to -c3, .sb-plxlayers-dot) |
3 glows of 60 to 120 px, 8 dots of 8 and 12 px | Colours, sizes and positions are set one by one. The dots follow the flexbox layout of .sb-plxlayers-mid: gap and padding spread them into a grid. |
Hint (HTML — span.sdc-scroll-hint) |
“Scroll ↓” over the bottom of the frame | Useful in the demo, where the frame only shows one glow at rest; remove it as soon as the tray has content that invites scrolling. |
FAQ
scroll() — but not the motion. Layered Parallax animates five decorative layers with a background growing by 30% and two rotations in opposite directions: a backdrop that twists. Here there are only four layers, vertical translations and nothing else, and two of them are text. Pick this one for a title page where a word and a sentence slide over each other; the other for a section background with volumes.top on .sb-plxlayers-back, as the three examples above do..sb-plxlayers-content and give them position: relative; z-index: 2: an absolute layer paints above the normal flow unless told otherwise. Just avoid any overflow: hidden between the layers and the scrolling area: it would bring back the failure described above. overflow: clip crops the same way without that drawback.