Web design techniques
Parallax web design
Parallax scrolling moves layers of a page at different speeds as you scroll, so the background drifts more slowly than the foreground and the page seems to have depth. It’s a technique rather than a style, and it’s most often used in hero sections, storytelling pages and product launches. Used lightly it adds atmosphere. Overdone, it makes pages slow, distracting and uncomfortable for some people.
A live example
Scroll inside the frame below. This parallax is pure CSS, using perspective rather than JavaScript, so it stays smooth. Then switch to the common mistake and scroll again.
Spring trips
Plan your next weekend away
Scroll inside this frame to see the layers move at different speeds.
Hills, lakes and long lunches
The sky moves slowest, the far hills a little faster, and the near hills move with the page. Your eye reads the difference in speed as depth.
Keep scrolling and the content slides up over the scene, as it would on a normal page. The text itself never moves at a different speed, so it stays easy to read.
Pick a city, choose your dates and we’ll put the whole trip in one place, from the train there to a table for dinner.
Done well: three background layers at gentle, different speeds, the text moving with the page so it’s easy to read, and the effect switched off for people who prefer reduced motion.
What makes parallax work
Layers
At least two layers, usually background, middle and foreground.
position: absoluteDifferent speeds
Further layers move more slowly than nearer ones.
translateZ(-2px) scale(3)Text at normal speed
Content people read moves with the page.
transform: noneAn off switch
The effect stops for people who prefer reduced motion.
prefers-reduced-motionThe CSS
This is CSS-only parallax. The scroll container gets a perspective, and each layer is pushed back in 3D space, then scaled up so it still fills the frame. The browser does the rest, with no JavaScript listening to scroll.
.parallax {
height: 100vh;
overflow-x: hidden;
overflow-y: auto;
perspective: 1px; /* the camera */
perspective-origin: 50% 0;
}
.parallax-hero {
position: relative;
height: 100vh;
transform-style: preserve-3d;
}
.layer {
position: absolute;
inset: 0;
transform-origin: 50% 0;
}
/* Further back = slower. Scale = 1 + depth / perspective */
.layer--sky { transform: translateZ(-3px) scale(4); }
.layer--far { transform: translateZ(-1px) scale(2); }
.layer--near { transform: none; }
/* Content sits above the scene and scrolls normally */
.content { position: relative; z-index: 1; background: #f2f1ec; }
@media (prefers-reduced-motion: reduce) {
.parallax { perspective: none; }
.layer { transform: none; }
}Tuning the values
| Property | A good starting range | What goes wrong outside it |
|---|---|---|
| Depth | -1px to -3px with 1px perspective | Deeper layers barely move and need huge scaling, which blurs images. |
| Layers | 2 to 4 | More layers add work for the browser with little extra effect. |
| Where to use it | Heroes and section breaks | Parallax on every section is tiring. |
| Text | Always at normal speed | Text that drifts at a different speed is hard to read. |
When it works
- Hero sections, landing pages and campaign sites.
- Storytelling pages and product launches.
- Travel, outdoor and architecture sites with strong imagery.
When to avoid it
- Pages people read or use for a long time.
- Sites where performance on older phones matters.
- Forms, checkout and anything where people need to concentrate.
Two ways to build it
CSS parallax or JavaScript parallax
There are two main ways to build parallax. The CSS approach shown here, and newer scroll-driven animations, let the browser handle everything. Older JavaScript approaches listen to every scroll event and move elements by hand, which is easy to get wrong.
CSS perspective
Works in every modern browser, runs smoothly and needs no JavaScript. The trade-off is that it needs its own scroll container.
Scroll-driven animations
animation-timeline: scroll()ties an animation to scroll position. Support is growing, so keep a static fallback.JavaScript on scroll
Moving elements in a scroll handler can stutter, especially on phones. If you must, use requestAnimationFrame and transforms only.
Always include an off switch
Whatever you use, check
prefers-reduced-motionand turn the effect off.
What to check when you review a parallax website
Parallax is about motion, so most of the checks are about comfort and performance, followed by readability.
@media (prefers-reduced-motion)1. Reduced motion
Turn on reduced motion in your system settings and check the layers stop moving.
.content2. Text speed
Check text moves at the same speed as the page. Drifting text is hard to read.
body3. Scrolling on a real phone
Check for stuttering on a mid-range phone. Parallax often feels smooth on a laptop and not on a phone.
.layer img4. Image size and blur
Layers pushed far back are scaled up. Check images are large enough not to blur, and still compressed.
.parallax5. Scroll containers
CSS parallax uses its own scroll container. Check keyboard scrolling, anchor links and the browser’s scroll position still work.
.hero h16. Text over moving backgrounds
Check headline contrast as the background moves behind it.
@media (max-width: 600px)7. Phones
Check the layers still line up on small screens, or switch the effect off.
background-attachment: fixed8. Fixed backgrounds
Check fixed backgrounds don’t jump or flicker on iPhones, where they often behave differently.
Reviewing with clients
Notes on exactly where the scrolling feels wrong
Parallax problems are about how scrolling feels on a particular device, so a client’s note needs to tell you exactly where on the page and on what. With ClickNote, clients click directly on elements of the website and leave a note, without creating an account or installing a browser extension.
Send your client a review link for the page.
They click the part that felt jumpy or hard to read and say what happened.
You get the selector, a screenshot and their device, so you can go straight to the right rule in your CSS.
This heading jumps around a bit when I scroll on my phone.
mobile · Safari on iPhone - 390 x 844
.px-hero-textReviewing a site in one of these styles?
Send your client a review link and they can click directly on elements of the website and leave a note, without creating an account or installing a browser extension. You get the selector, a screenshot and their device with every note.
14-day free trial. No card needed. See pricing.