View Transitions API

Also called CSS view transitions or startViewTransition

A browser feature that animates between two states of a page by snapshotting the old view, applying your update, and animating to the new one.

View Transitions API explained

The View Transitions API lets the browser do the hard part of a transition. You call document.startViewTransition() with a function that updates the page. The browser captures a snapshot of the current page, runs your update, then animates from the old snapshot to the new, live view. By default, the whole page crossfades.

Give an element a view-transition-name and the browser animates it separately: it moves and resizes that element from its old position to its new one while the rest of the page crossfades. That is how a thumbnail can grow into a hero image without an animation library. Each name must be unique on the page at the moment of the snapshot.

Customize the motion with CSS pseudo-elements such as ::view-transition-old(root) and ::view-transition-new(root), using ordinary animation properties. For multi-page sites, adding @view-transition { navigation: auto; } to both pages animates same-origin navigations in browsers that support it. The old view is a still image during the animation, so keep it short.

Same-document transitions work in current versions of Chrome, Edge, Safari, and Firefox; cross-document support is less complete. Check that document.startViewTransition exists and call your update directly when it does not, and turn the animations off for people who prefer reduced motion.

Often confused with

Page transition
A page transition is any animation between pages. The View Transitions API is a built-in browser way to create one, with or without a JavaScript animation library.
All terms

Shared element transition

A transition where an element from one view, like a thumbnail, travels and grows into its place in the next view, linking the two screens.

Crossfade

A transition where the old content fades out while the new content fades in at the same spot, so the two briefly overlap.

Reduced motion

An operating system setting that asks apps to minimize movement, which websites detect with the prefers-reduced-motion media query.

Page transition

An animation that plays when you move from one page or screen to another, such as the old page fading out as the new one fades in.