Smooth page-to-page animations on ordinary multi-page sites, with no JavaScript framework and no single-page-app router, are about to work in every major browser. Firefox 162 enables cross-document view transitions by default, according to the Firefox 162 release notes for developers. Firefox 162 is in Beta now and is scheduled to ship on 8 December 2026.

MDN’s browser compatibility data lists the @view-transition at-rule in Chrome and Edge 126, Safari 18.2 and Firefox 162. Once Firefox 162 is stable, the feature is supported across all three engines. This guide shows how to add cross-document transitions to a classic multi-page site, animate shared elements, use transition types, and keep everything accessible.

How cross-document view transitions work

When a user follows a link from page A to page B on the same origin, the browser:

  1. takes a snapshot of page A,
  2. loads and renders page B,
  3. animates from the old snapshot to the new page using pseudo-elements you can style with CSS.

Both pages must opt in. According to MDN, a transition only runs when the navigation is same-origin, without cross-origin redirects, and its type is traverse (back/forward), push or replace. Push and replace navigations must be started by the user interacting with the page, not by browser UI such as the address bar.

Step 1: Opt in on every page

Put this in a stylesheet that both pages load:

@view-transition {
  navigation: auto;
}

That’s the whole minimum. Click a link between two opted-in pages and you get the default cross-fade. Browsers without support ignore the rule and navigate normally, so this is progressive enhancement with no fallback code.

Step 2: Customise the page animation

The browser builds a tree of pseudo-elements during the transition. The root snapshot is named root, and you target the outgoing and incoming states with ::view-transition-old() and ::view-transition-new():

@keyframes slide-out {
  to { transform: translateX(-30%); opacity: 0; }
}
@keyframes slide-in {
  from { transform: translateX(30%); opacity: 0; }
}

::view-transition-old(root) {
  animation: 250ms ease-in both slide-out;
}
::view-transition-new(root) {
  animation: 300ms ease-out both slide-in;
}

Keep durations short (200–400 ms). Page transitions should feel quick, not like a slideshow.

Step 3: Morph shared elements between pages

The best part of view transitions is animating one element into its counterpart on the next page, for example a product thumbnail growing into the hero image. Give the matching elements the same view-transition-name on both pages:

<!-- products.html -->
<a href="/products/42.html">
  <img src="/img/42.jpg" alt="Desk lamp" class="thumb" style="view-transition-name: product-42">
</a>

<!-- products/42.html -->
<img src="/img/42.jpg" alt="Desk lamp" class="hero" style="view-transition-name: product-42">

The browser works out the position and size change and animates between them. Two rules to remember:

  • A view-transition-name must be unique on the page at the moment the snapshot is taken. In a list, generate one name per item (product-42, product-43, …) or set the name only on the clicked item.
  • Names are plain identifiers, not strings: view-transition-name: product-42;

You can style a specific pair, too:

::view-transition-group(product-42) {
  animation-duration: 350ms;
}

To style many elements at once without writing a rule per name, use view-transition-class:

.thumb, .hero { view-transition-class: product-image; }

::view-transition-group(*.product-image) {
  animation-duration: 350ms;
  animation-timing-function: cubic-bezier(.2, .8, .2, 1);
}

MDN lists view-transition-class as supported in Chrome 125, Safari 18.2 and Firefox 144.

Step 4: Different animations for different journeys

Going “deeper” into a section and going back should usually animate in opposite directions. View transition types let you label a transition and style it conditionally with :active-view-transition-type().

The @view-transition rule accepts a types descriptor for a fixed type:

@view-transition {
  navigation: auto;
  types: slide;
}

html:active-view-transition-type(slide) {
  &::view-transition-old(root) { animation: 250ms both slide-out; }
  &::view-transition-new(root) { animation: 300ms both slide-in; }
}

For types that depend on where the user is going, set them from JavaScript in the new page’s pagereveal event. MDN lists pagereveal and pageswap in Firefox 162 too.

<script>
  window.addEventListener('pagereveal', (event) => {
    if (!event.viewTransition) return; // no transition for this navigation

    const from = document.referrer ? new URL(document.referrer).pathname : '';
    const goingBack = from.startsWith(location.pathname) && from !== location.pathname;
    event.viewTransition.types.add(goingBack ? 'backwards' : 'forwards');
  });
</script>
html:active-view-transition-type(backwards) {
  &::view-transition-old(root) { animation-name: slide-in; animation-direction: reverse; }
  &::view-transition-new(root) { animation-name: slide-out; animation-direction: reverse; }
}

Put the pagereveal listener in a classic script in the <head>, so it’s registered before the first frame is rendered. pageswap is the counterpart on the outgoing page, if you need to set names or types just before the snapshot.

Step 5: Respect reduced motion

Some users get motion sickness from sliding and zooming effects. Turn the custom animations off when they’ve asked for less motion:

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}

Or wrap the whole opt-in so reduced-motion users get instant navigation:

@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
}

Performance tips

  • Don’t block rendering for long. The transition waits for the new page to render. A slow server or render-blocking scripts make transitions feel sluggish, so fix those first.
  • Name only what you animate. Every named element creates its own snapshot and pseudo-element group. A handful is fine; hundreds on a long list is not.
  • Test back and forward. Traverse navigations take part too, so check that your direction logic looks right in both directions.

Testing across browsers

  1. Install Firefox Beta (162) to test today, or wait for the stable release on 8 December.
  2. Test in Chrome or Edge 126+ and Safari 18.2+.
  3. Use a browser without support (or temporarily remove the rule) to confirm normal navigation still works.
  4. In Chromium DevTools, the Animations panel can slow down and replay view transitions, which helps when tuning timings.

Takeaway

With Firefox 162, cross-document view transitions arrive in the last major engine. A two-line @view-transition { navigation: auto; } gives any same-origin multi-page site smooth navigation. Add view-transition-name for shared elements and types for direction-aware motion, and keep a prefers-reduced-motion escape hatch. It’s progressive enhancement, so you can ship it today.

Sources: Firefox 162 for developers (MDN), @view-transition (MDN), Using the View Transition API (MDN).