ScrollPremium

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.

CSSParallaxLayers

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

Opening of the month of March — a plant nursery's online almanac — Parallax Layers CSS example 1

① Opening of the month of March — a plant nursery's online almanac

WhenEach month of the almanac opens on a large title page: the month's name very large, a strapline, then the jobs to do. You wheel down to the three boxes.
WhyThe word “MARCH” is a backdrop, the sentence is the real title: sliding them at two speeds separates them with no rule or frame. On the way down the word shoots upwards and leaves the sentence alone for a moment, just before the boxes — the eye is led from the decoration to the useful text.
SettingsA 540 × 316 px area, tray shortened to 560 px (244 px of travel: the same pixel amplitudes look livelier). Word at 158 px (124 px in English), green at 14%, moved up to top: 150px; sentence in 22 px Georgia italic at top: 262px; glows recoloured yellow, green and pink; row of dots lowered under the sentence. Capture: scrolling at 96 px/s by a timer in the scene.
Programme of Fireflies Night — a regional park's nature outing, on a phone — Parallax Layers CSS example 2

② Programme of Fireflies Night — a regional park's nature outing, on a phone

WhenMobile page for a guided night outing: the title, then four timetable cards pushed up with the thumb, from the car-park meeting point to the walk back.
WhyHere the layers carry no text to read: glows and dots are recoloured as yellow-green lights and pass behind half-transparent cards. Because they climb faster than the cards, they look like fireflies rising in the clearing — the scrolling makes the motion, with no video and no script.
SettingsA 190 × 318 px area, 720 px tray (402 px of travel). Glows of 80 to 130 px in a radial gradient of rgba(214,255,120,…), 4 and 5 px dots with a glowing box-shadow, spaced 112 × 64 px apart. The word “NIGHT” at 10%. The programme cards sit above (z-index: 2), background at 58% opacity. Capture: 78 px/s, timer in the scene.
Winners of a jam competition — projected during the prize-giving — Parallax Layers CSS example 3

③ Winners of a jam competition — projected during the prize-giving

WhenVillage-hall screen during the prize-giving: the list of winners scrolls by itself, category by category, while the host calls people up.
WhyA list climbing by itself over a flat background soon looks like a notice board. The large fruit-coloured glows and the word “WINNERS” drifting faster than the names give the screen depth without getting in the way: the winners' lines stay on dark, crisp cards.
SettingsA 540 × 360 px area, 940 px tray (580 px of travel). Glows of 210 to 300 px in orange, raspberry and violet; word at 92 px, white at 13%; sentence at 15 px in apricot. Four category cards on z-index: 2. The automatic scrolling (72 px/s) is a timer in the scene; the effect merely responds to scrolling.

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: reduce the 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-front sentence 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 carries aria-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-size or 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.

Chrome 115+✓ Full (measured in Chromium 149)
Edge 115+✓ Not verified (same engine as Chrome)
Safari 26+✓ Full in the WebKit 26.5 test build; real Safari not verified
Firefox 159+✓ Not verified (support announced by MDN)
Firefox up to 158✓ Static layers, everything stays readable (measured in Firefox 151)
iOS 26+ / Android Chrome 115+✓ Not verified on a device

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):

index.html — structure
<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 / propertyDefaultEffect
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

The skeleton is shared — absolute layers in a 900 px tray, read by 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.
Because the tray is 900 px tall and the demo only shows 280 of them. At rest you see the top of the tray, where there is just one glow; the word arrives after 77 px, the sentence after 207. In a real page this tray is one section among others and you scroll into it. For a demo that opens on the word, shorten the tray or raise top on .sb-plxlayers-back, as the three examples above do.
Yes, it is even the most common use. Add your blocks inside .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.