Back to Snippets

CSS Scroll-Driven Parallax Hero

A landing page hero with a sun, two ranges of hills and a headline. Scroll down and the layers separate. The sun and far hills drift slowly, the near hills move faster, and the title fades and lifts away before the content section takes over.

Each layer has a normal keyframe animation, but instead of running on a clock it is bound to the page scroll with animation-timeline set to scroll on the root. animation-range limits the effect to the first screen of scrolling, so the layers settle once the hero has gone. The differing distances in the keyframes create the depth.

Scroll-driven animations are in Chrome, Edge and Safari 26 and sit on the Interop 2026 list, with Firefox still behind a flag. The @supports rule only enables them where the timeline exists, so elsewhere the hero is a static illustration.

0
#css
#html
#parallax
#hero
#scroll-driven animation
#animation
#landing page
#header