← Back to release summary

CSS transition-behavior property

Category
CSS
Type
New or changed feature
Status
Enabled by default (Chrome 117)
Intent stage
Prepare to ship

Summary

The transition-behavior CSS property is a longhand of the transition property which allows discrete properties to be used in transitions. By specifying the "allow-discrete" value for transition-behavior, discrete properties will now start animations and flip from their initial value to their final value at 50%, except for transitions where display:none and content-visibility:hidden are one of the initial or final values, in which case the visible value will be used for the entire duration of the transition. More details here: https://drafts.csswg.org/css-transitions-2/#transition-behavior-property

Motivation

The web-animations allows developers to define custom transitions by modifying those animations. In theory, this would let a developer define a transition for property types which are animation type Discrete, however css-transitions-1 defines discrete animations as not transitionable which prevents this. Additionally, there are use cases for transitioning discrete properties (e.g. visibility, display, etc) which currently require developers to create an animation or use javascript to control. By allowing transitions on discrete properties, developers can: * Implement custom transitions for any animateable property * Use transitions for hiding components

Standards & signals

Samples: https://output.jsbin.com/buquher/quiet

Explainers: https://github.com/w3c/csswg-drafts/issues/4441#issuecomment-1329749962

View on chromestatus.com