CKTIS / CSS
::view-transition-new() — new-state image
The ::view-transition-new() pseudo-element styles the new-state image during a view transition, for example by giving it a custom entrance animation.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
::view-transition-new(<pt-name-and-class-selector>)
<pt-name-and-class-selector> = <pt-name-selector> <pt-class-selector>? | <pt-class-selector>
<pt-name-selector> = '*' | <custom-ident>
<pt-class-selector> = ['.' <custom-ident>]+
/* Whitespace is allowed before and after the argument inside the parentheses, but not between the components of a compound argument. */::view-transition-new() represents the new-state image as a replaced element in the temporary transition tree. It is a child of ::view-transition-image-pair() and is absent when there is no new state. Unlike the static image in ::view-transition-old(), its content can be updated during the transition.
The argument panel matches the name view-transition-name: panel, not a DOM ID. root is the document element's default name, while * matches all names. Level 2 also permits .card and panel.card, referring to view-transition-class, not DOM classes. Inside the parentheses, whitespace is allowed before and after the argument, but not between the components of a compound argument.
The selector alone does not start a transition. The example uses document.startViewTransition() and applies the custom reveal animation only to the panel's new image. When reduced motion is not requested, the old image still plays its default fade-out animation. Without the API, the text changes immediately. A reduced-motion preference disables the custom animation. Check support locally; the specification draft does not guarantee implementation.
Examples
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<title>New state transition</title>
<style>
#panel { view-transition-name: panel; padding: 1rem; background: lightblue; }
::view-transition-new(panel) { animation: reveal 600ms ease-out both; }
@keyframes reveal {
from { opacity: 0; transform: translateY(12px); }
to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
::view-transition-group(*) { animation-duration: 0s; }
::view-transition-new(panel) { animation: none; }
}
</style>
<button id="change" type="button">Update</button>
<p id="panel">Before</p>
<script>
const button = document.querySelector('#change');
const panel = document.querySelector('#panel');
button.addEventListener('click', () => {
const update = () => { panel.textContent = 'After'; };
if (typeof document.startViewTransition === 'function') {
document.startViewTransition(update);
} else {
update();
}
}, { once: true });
</script>
</html>Result
After
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.