Home / 3D and Depth / Perspective Scroll

Perspective Scroll CSS Template, Free with Live Demo

Free perspective scroll template for a year in review page. Big stat panels tip back in 3D and flatten out as they reach the middle of the screen. Live demo. The example is Fieldnote, a year in review page.

Open live demoDownload HTML fileView code on GitHub
Perspective Scroll CSS template example: Fieldnote, a year in review page

What is perspective scroll?

Perspective scroll makes panels tilt back in 3D as they come up from the bottom of the screen, then lie flat when they reach the middle. It feels like pages of a book being laid down in front of you.

The parent has perspective, and each panel rotates on its bottom edge. A small script works out how far each panel is from the center of the screen and sets the angle, once per frame.

Good for

  • Year in review and wrapped pages
  • Big number and stat stories
  • Product feature tours
  • Portfolio highlights

What you get in this template

The key CSS

This is the part that makes the perspective scroll look work. Copy it into your own project.

.stage { perspective: 1200px; }
.pn {
  transform: rotateX(var(--r)) scale(var(--s));
  transform-origin: 50% 100%;
  will-change: transform;
}
/* JS: d = distance from screen center, -1 to 1 */
/* --r = d > 0 ? d * 38deg : d * -12deg */

How to use it

  1. Click Download HTML file above.
  2. Open the file in any code editor, like VS Code.
  3. Change the text, colors and links to match your project. Colors are at the top of the style tag.
  4. Upload it to any host, such as GitHub Pages, Netlify or your own server. It is one file with no build step.

Questions people ask

How do you tilt elements in 3D on scroll?

Put perspective on the parent and change each element rotateX based on its position on screen, read with getBoundingClientRect during scroll.

Why use transform-origin at the bottom?

It makes the panel hinge on its bottom edge, like a card being laid down, instead of spinning around its middle.

Can this be done with only CSS?

Yes, in browsers that support scroll driven animations, with animation-timeline: view(). The script version works everywhere.

More 3D and Depth designs