CSS view-transition-class Property
Description
The view-transition-class property lets authors specify one or more CSS class names that the UA will apply to an element for the duration of a view transition. Its purpose is to give a stable, author-controlled way to change the visual appearance of an element only while the page is being animated between states, without permanently mutating the element’s classes in the DOM. This makes it straightforward to tailor the transitional snapshots that the browser uses for cross-fade, shared-element, or other view-transition effects, so the animated representations can differ from the element’s normal runtime appearance.
Because those classes are applied only for the lifetime of the transition, they are useful for isolating transition-specific styling: you can tweak backgrounds, opacity, transform, filters, or pointer behavior for the transitional layer without affecting layout or interaction once the transition ends. In practice authors often combine transitional classes with standard motion properties such as transition and animation so that the visual changes introduced by the transitional classes are animated smoothly. The property is also frequently used alongside matching identifiers that link elements across views (for example, when coordinating shared-element transitions via view-transition-name) so that both ends of a visual match can receive the same transitional styling.
When designing transitional classes, favor non-layout-changing visual properties (transforms, opacity, filters) for the best performance and most consistent results: those are typically GPU-accelerated and compose well in the browser’s snapshot-based animation pipeline. Keep the classes focused and predictable - avoid introducing large reflows or script-driven side effects while a transition is active. Finally, treat the classes as ephemeral styling aids: they are applied by the UA only for the transition and removed automatically when the animation completes, so any permanent state changes needed after the transition should still be performed by your application logic.
Definition
- Initial value
- none
- Applies to
- all elements
- Inherited
- no
- Computed value
- as specified
- Animatable
- yes
- JavaScript syntax
- object.style.viewTransitionClass
Syntax
view-transition-class: <class-name>;
Values
- <class-name>The name of a CSS class you want applied to the element only during a view transition. Multiple class names are allowed, separated by spaces.
Example
Browser Support
The following information will show you the current browser support for the CSS view-transition-class property. Hover over a browser icon to see the version that first introduced support for this CSS property.
This property is supported by all modern browsers.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 1st January 2026
