This feature is not Baseline because it does not work in some of the most widely-used browsers.
The :active-view-transition CSS pseudo-class matches the root element of a document when a view transition is in progress (active) and stops matching once the transition has completed.
:root:active-view-transition ... {
/* ... */
}
This example extends on the same-document view transition example on the startViewTransition page.
<main>
<section class="color">
<h2>Color is changing!</h2>
</section>
<button id="change-color">Change Color</button>
</main>
A <h2> element initially has a display: none style, and this is overwritten using the :active-view-transition pseudo-class setting the <h2> style to display: block. The button is hidden using visibility: hidden, when the view transition is in progress:
h2 {
display: none;
color: white;
}
:root:active-view-transition h2 {
display: block;
}
:root:active-view-transition button {
visibility: hidden;
}
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
:active-view-transition |
125 | 125 | preview141 | 111 | 18 | 125 | No | 83 | 18 | 27.0 | 125 | 18 |
:active-view-transition-type() pseudo-classstartViewTransition method
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/:active-view-transition