CSS transition-behavior Property
The transition-behavior property, set to allow-discrete, lets discrete properties such as display and overlay take part in transitions.
Description
The transition-behavior property controls whether transitions run for properties that are animated discretely, such as display, content-visibility and overlay. Normally these properties flip instantly and are ignored by transitions. With allow-discrete the change is included in the transition and the flip happens at the end (or, for values like display: none becoming visible, at the start).
This makes it possible to fade out an element and only then set it to display: none, or to animate popovers and dialogs as they open and close. For entry animations it is used together with the @starting-style at-rule, which provides the starting values for an element that has just been displayed.
.panel {
transition: opacity 0.4s, display 0.4s allow-discrete;
}
.panel.hidden {
opacity: 0;
display: none;
}
The keyword can also be written inside the transition shorthand, as in the example above.
Definition
- Initial value
- normal
- Applies to
- all elements
- Inherited
- no
- Computed value
- as specified
- Animatable
- not animatable
- JavaScript syntax
- object.style.transitionBehavior
Interactive Demo
Syntax
transition-behavior: <transition-behavior-value>#; /* normal | allow-discrete */
Values
- normalThe default. Transitions are not started for discretely animated properties.
- allow-discreteTransitions are started for discretely animated properties too; the value flips at the end (or start) of the transition.
- initialSets the property to its initial value.
- inheritTakes the computed value of the parent element.
Example
Browser Support
The following information will show you the current browser support for the CSS transition-behavior property. Hover over a browser icon to see the version that first introduced support for this CSS property.
Desktop





Tablets & Mobile





