alt.hn

6/2/2026 at 10:23:37 AM

CSS-Native Parallax Effect

https://dan-webnotes.com/posts/2026-06-02-css-native-parallax-effect/

by dandep

6/2/2026 at 10:51:02 AM

That sounds interesting but it would be a whole lot more interesting if the page was itself an example of said effect!

by baliex

6/2/2026 at 4:57:50 PM

I've put together an example here but it doesn't seem to work in Firefox 151.0.2 (64-bit): https://favs.eu.org/parallax/

Edit: if the body has class="no-sda", it uses a js fallback.

by sourcecodeplz

6/2/2026 at 3:01:33 PM

Or even linked to one!

by jonahx

6/2/2026 at 12:19:00 PM

I was also looking for examples.

by dsmurrell

6/2/2026 at 12:45:40 PM

i was waiting for the effect to show up

by yashD18

6/2/2026 at 10:58:54 AM

How does this compare to the classic css-native parallax effect? Before the scroll timeline APIs you'd use the "perspective" css property to create a container where the z plane is n pixels away from the screen, and then position each layer within it at a different z distance using transform: translateZ

That method is GPU accelerated too, so it is performant compared to some js solutions, and has worked well in every browser for around a decade

I like the idea of the scroll-timeline though, just keen to understand what the advantage is for this

by mpeg

6/2/2026 at 12:25:35 PM

OP here, thanks for asking. While the `perspective` technique works too, it has the downside of needing a careful combination of scroller elements and properties.

This approach adds a single class to the image container and that's it. Plus you can control many aspects of the animation such as entry/exit ranges, and make it control other properties like opacity or color, for example.

I know browser support is still lacking, but it will get there eventually. I'm not using this in production code yet, but I think it's useful to experiment with these new CSS APIs.

by dandep

6/2/2026 at 3:51:25 PM

This method should still support GPU acceleration, as `transform` (or rotate/scale/etc.) is the only property being animated. The benefit of animation-timeline seems to be that it's much easier to set up than a CSS perspective context.

by semolino

6/2/2026 at 11:48:02 AM

No doubt quite a few folk with the same question. Keen to understand performance tradeoffs.

Obvious comparison note would be that the "new" method currently enjoys somewhat limited browser support (no Firefox without a flag, and only since Safari 26)

by som

6/2/2026 at 11:20:37 AM

I was wondering the same thing. That translateZ is a bit fiddly to get right, so I could believe this is a bit easier to use, maybe? And presumably this could be used for other properties besides position, like colors, opacity or blurs.

by iainmerrick

6/2/2026 at 10:52:48 AM

A demo https://codepen.io/editor/phelm/pen/019e87f5-dfec-7372-9849-...

by phelm

6/2/2026 at 10:53:55 AM

There's me scrolling up and down and thinking "hey, it's not working!" But it's behind a flag on Firefox: https://caniuse.com/?search=view-timeline-name

by frereubu

6/2/2026 at 1:20:37 PM

For people saying it's not working in any browser - do you have some kind of reduced motion preference setting turned on? I can imagine that would have an effect on something like this and it's definitely working in Chrome for me.

by frereubu

6/2/2026 at 1:29:30 PM

Yes... there's a media query in the codepen disabling animation for people with reduced motion enabled.

by cj

6/2/2026 at 11:26:15 AM

It's been behind a flag for ages. Maybe because of performance issues?

by werdnapk

6/2/2026 at 3:34:15 PM

Enabling (layout.css.scroll-driven-animations.enabled) and refreshing the codepen gives a "we crashed this to prevent a crash from an infinite loop" clicking to allow the infinite loops allowed me to see the animation.

Fedora 44 Kernel: x86_64 Linux 7.0.10-201.fc44.x86_64 Firefox 151.0.2

by goodmythical

6/2/2026 at 11:10:42 AM

Noticed the same thing. In Mac Safari it works without setting any flags.

by anssip

6/2/2026 at 12:11:56 PM

Doesnt work on any browser for me

by wnevets

6/2/2026 at 11:28:51 AM

tried 4 browsers, didn't work in any of them

by WithinReason

6/2/2026 at 11:46:16 AM

FWIW it works on iPhone safari

by alpinisme

6/2/2026 at 1:05:45 PM

Only on iOS 26.

by layer8

6/2/2026 at 12:45:41 PM

I don’t think it did for me. Are you on iOS 26?

by abejfehr

6/2/2026 at 11:39:05 AM

Only worked for me on mobile (vivaldi android) not on vivaldi / chrome / edge on Desktop.

by Mashimo

6/2/2026 at 11:19:12 AM

What an age where we need a pile of javascript as well as a bot check to demo a simple CSS trick.

by account42

6/2/2026 at 12:03:06 PM

The JS and bot check are for making additional functionality, beyond just showing the example, work easily. I.e. editing and sharing edits from a browser. If all you want is a static example, feel free to make it without these things.

by zamadatix

6/2/2026 at 11:26:53 AM

You can make some really cool stuff with css scroll animations. I used SVG paths with a scroll animated dash offset to draw an image while scrolling. Zero javascript, it feels so smooth. https://thomaswelter.nl (the background)

by thomasikzelf

6/2/2026 at 4:43:47 PM

oh that's cool!

Can only see it on chrome though =/. I switched to Safari as the lesser of two data-harvesting evils. Or rather, with an iPhone I've already chosen my overlord. I also switched to Kagi. Trying to deGoogle myself.

by apsurd

6/2/2026 at 12:13:51 PM

Android Firefox: there is no background image.

by rsyring

6/2/2026 at 12:26:37 PM

firefox android does not support CSS animation-timeline, and firefox desktop needs layout.css.scroll-driven-animations.enabled. This probably should not be used for any critical features.

by thomasikzelf

6/2/2026 at 1:12:09 PM

I played around with this API some time ago. It’s simple and high-performance, but one feature I wish existed is damping. Scroll-driven animations are tied directly to the scroll timeline, so there’s no concept of the parallax object “catching up” to the scroll progress over, say, one second. From what I remember, `animation-timing-function` feels weird when you scroll, so it’s not the right solution. GSAP offers this, but it’s JS-only.

by mrcsmcln

6/2/2026 at 11:47:39 AM

It would be awesome to put an interactive example right in the article.

by sillyboi

6/2/2026 at 3:53:53 PM

I was expecting a demo on the linked page itself. Interesting to let Codex or Claude Code do it :)

by Onplana

6/2/2026 at 3:58:12 PM

Using css perspective for parallax has been around for years and is much simpler code.

by geuis

6/2/2026 at 3:14:58 PM

there is a special place in hell for pages like these that don't show examples

by thecaio

6/2/2026 at 11:28:09 AM

Love the one-variable design where scale and translate stay in sync automatically, just wish Firefox would get off the flag already.

by rohitsriram

6/2/2026 at 12:26:25 PM

Thanks!

by dandep

6/2/2026 at 11:30:51 AM

In a world where it's increasingly overlooked, I'm glad the author mentions disabling it respecting user settings. I do think it should be reversed and only enabled with the `@media (prefers-reduced-motion: no-preference)`, but that is the opinion of someone who gets negative value from animations and is bemused by how much dev and compute time is spent on them.

by duskdozer

6/2/2026 at 1:33:36 PM

could this be combined with a sprite like image that shows a slightly different angle of the image with each step

by albert_e

6/2/2026 at 12:25:54 PM

Idk about anyone here but I find the effect disorienting.

by i_am_a_peasant

6/2/2026 at 12:33:17 PM

Yes. I'm a little more sensitive than average, but not enough to turn off animations, and this is uncomfortable.

by amon_spek

6/2/2026 at 4:15:15 PM

I get motion sickness from this specific effect. Especially on high refresh rate screens.

by hit8run

6/2/2026 at 2:23:47 PM

Hey, where's the demo?

by tantalor

6/2/2026 at 2:02:04 PM

Great. I tried the Google examples a while ago and got nowhere with it, time for another go, within the netherworld of SVG, to map to several different layers.

by Theodores

6/2/2026 at 11:51:54 AM

[flagged]

by xuzhenpeng

6/2/2026 at 2:05:33 PM

[dead]

by swordlucky666