One Line of CSS Enables Smooth Page Transitions Without JavaScript
A native CSS feature called the View Transition API now allows multi-page websites to cross-fade between pages instead of showing a jarring white flash on navigation. Supported since Chrome 126, Edge 126, Safari 18.2, and Opera 112, the effect is activated by adding a single CSS rule — @view-transition { navigation: auto; } — to a shared stylesheet. The API works by capturing a screenshot of the outgoing page, rendering the new one, and blending the two together using GPU-accelerated animation. Developers can also apply the same API to in-page interactions like toggling panels or filtering lists using the JavaScript startViewTransition method. The feature is progressively enhanced, meaning unsupported browsers simply fall back to standard navigation without errors or broken animations.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in