doTemplate

Web design & front-end, since 2008

HomeCSS & CodePage Transitions With the View Transitions API

CSS & Code4 min read

Page Transitions With the View Transitions API

The View Transitions API lets browsers animate between the previous and next states of a page, enhancing the feel of a site with fluid movement. MPA and SPA sites act very differently, and this API does nothing to change browser's natural behavior: showing a web page. Instead, the API lets authors add motion to the default navigational experience with low risk, since the browser navigates the page even if the transition doesn't run.

Page Transitions With the View Transitions API
Diagram: doTemplate
In this article
  1. How the browser animates the swap
  2. Same-document transitions
  3. Cross-document transitions
  4. Naming only what matters
  5. What the writer should be careful not to overclaim
  6. Why it matters on static sites
  7. How it works: view transition
  8. Leveraging capabilities while avoiding overreach

Moving a site between views, whether it's between pages or states in a single page, is an important part of web authoring. It's not essential for functionality, since the browser downloads and shows the new page, but can improve the perception of speed and discourage "back" button use.

However, browser support as of 2026 is still not fully complete

How the browser animates the swap

The transition occurs because the browser creates two images:

It uses a command queue to move elements from the current position to the new, as described in spec

Same-document transitions

Cross-document transitions

One of the most significant extensions in Level 2 is support for navigation across documents, such as navigating between pages in a multi-page application (MPA). However, to animate between documents, the browser requires:

  1. The new page must be same-origin as the outgoing page. Cross-origin security requirements have not changed. 2. The page must stay visible during the transition. 3. The navigation must be user-initiated, which affects attributes such as rel="preload" and other situations that auto-navigate after the page initially loads.

Cross-document transitions animate navigation on the same origin, and then use a pagereveal pseudo-element to underline which parts move between the outgoing page to the incoming one.

Cross-document navigational transitions are more limited than the same-page ones: the browser must keep the page visible to animate across navigations, and both the new and old pages must be from the same origin. Additionally, the navigation must be user-initiated rather than an auto-navigate from link with rel="preload" or a similar situation.

Cross-document support, while a much-requested feature, is still not complete as of 2026.

Naming only what matters

The API supports complex transitions between different parts of a page, without explicitly making all elements move. A view-transition-name CSS property attaches a name to an element, so the author can ensure the browser only moves the most important parts.

This matches the authoring goal of changing the visual focus, rather than making all elements move visibly, which distracts from content rather than enhancing the browsing experience.

What the writer should be careful not to overclaim

Accessibility is first, and plain vanilla cross-fades are not accessible for people with vestibular issues, but the API only activates animations when a media query matched the user's browser:

However, the author still needs to ensure the page is usable with the transition disabled. Since all transitions skip under many circumstances, the author should consider the existing experience to be the true "default". The transition simply adds motion to that default.

Same-document transitions must be called by a developer. While trivial, this requires adding JavaScript.

Across documents, the browser auto-generates named pseudo-elements, but the author specifically names any elements to transition with the view-transition-name property. The author styles these with `pseudo-html attribute selectors.

Why it matters on static sites

Historically, MPAs and SPAs behaved differently when navigating. When moving to a new link in a SPA, the browser could animate the transitions. However, when switching links in a static site, the browser downloaded the new page in an instant:

When using the View Transitions API, browsers can animate the transition: whether across documents or within a single document, it feels faster and more fluid. On a single-page app, the author has far more information about the transition, but on a multi-page application can now animate to matches the feeling of a SPA with less effort.

How it works: view transition

The situations are similar. In each of these examples:

Within the document, a developer can trigger the transition with JavaScript:

document.startViewTransition( => { // changes to the DOM that define the transition end state. }) ]

Across documents, official browser documentation describes both the called transition:

Then, the browser auto-generates the same pageswap and pagereveal pseudo-elements that the same-page functionality provides.

Level 2 of the View Transitions specification includes a richer authoring model that integrates cross-origin transitions. It also adds the @view-transition rule, and selectable transitions with view-transition-class and named pseudo-element additions.

Leveraging capabilities while avoiding overreach

The key to using the View Transitions API is realizing its strengths:

And, like all authors, the developer should realize the same constraints: