Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

@view-transition — cross-document transitions

@view-transition enables visual transitions for eligible navigations between same-origin documents.

Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required

Syntax

@view-transition {
  navigation: auto | none;
  types: none | <custom-ident>+;
}

@view-transition contains descriptors, not selectors. navigation: auto is required in both documents; the initial none disables the transition.

auto covers eligible same-origin navigations without cross-origin redirects. It includes history traversal, but not reloads or address-bar navigation.

Optional types accepts none or space-separated identifiers; they cannot start with -ua-. Types apply locally to each document.

The rule does not trigger DOM updates through document.startViewTransition(). The browser may skip animation; an unsupported rule is ignored.

Examples

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Cross-document view transition opt-in</title>
  <style id="opt-in">
    @view-transition {
      navigation: auto;
    }
  </style>
</head>
<body>
  <h1>Cross-document view transition opt-in</h1>
  <p>Both documents must opt in for an eligible same-origin navigation to transition. This example checks the opt-in without navigating.</p>
  <script>
    const rule = document.getElementById('opt-in').sheet.cssRules[0];
    const supported = rule && /^@view-transition\s*\{/.test(rule.cssText)
      && /\bnavigation:\s*auto\s*;/.test(rule.cssText);
    console.log(supported
      ? '@view-transition supported: navigation: auto parsed'
      : '@view-transition opt-in unsupported');
  </script>
</body>
</html>

Result

@view-transition supported: navigation: auto parsed

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources