# :active-view-transition

> The `:active-view-transition` CSS pseudo-class selects the root element while a view transition is running.

## How do I style the page only while a view transition runs?

The pseudo-class that matches the root element of the document during an active view transition. Useful for disabling interactions or changing styles only for the time of the animation.

- Topic: Pseudo Classes
- Type: pseudo-class
- Browser support: Chrome 125+, Chrome Android 125+, Edge 125+, Firefox 144+, Firefox Android 144+, Safari 18+, Safari iOS 18+

## Example

Wrong:

```css
html.transitioning {
  pointer-events: none;
}
```

Right:

```css
html:active-view-transition {
  pointer-events: none;
}
```

The pseudo-class matches only while the transition runs, so no class has to be added and removed in JavaScript.

## Common mistakes

- Expecting it to match elements other than the root element.

## Key points

- Styles for the transition period use `:active-view-transition` instead of a class added and removed by JavaScript.
- A specific transition is targeted with `:active-view-transition-type()` and types passed to `startViewTransition()`.
- Motion is removed or reduced inside `@media (prefers-reduced-motion: reduce)`.

## Interview questions

### How do I target one type of view transition?

Pass types to `startViewTransition({ update, types: ['slide'] })` and select them with `:active-view-transition-type(slide)`.

### Which element matches :active-view-transition?

For a document transition, the root element `<html>`. Style other parts with descendant selectors, like `:active-view-transition header`.

## Related cards

- [::view-transition](https://wonderium.dev/css/view-transition.md)
- [document.startViewTransition()](https://wonderium.dev/js/start-view-transition.md)
- [view-transition-name](https://wonderium.dev/css/view-transition-name.md)
- [::view-transition-group()](https://wonderium.dev/css/view-transition-group.md)

---

- Level: [CSS](https://wonderium.dev/css.md)
- HTML version: https://wonderium.dev/css/active-view-transition
- Last updated: 2026-11-25
