Favorites

CSS transition-behavior Property

transition-behavior
CSS PropertyThis property is supported by all modern browsers.
Updated 22nd November 2026

The transition-behavior property, set to allow-discrete, lets discrete properties such as display and overlay take part in transitions.

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee

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

Hover over this grey area. The pink box goes from display: none to block.
Fade in and out
Demo Code
HTML Code
<div class="demo-area">
	Hover over this grey area. The pink box goes from display: none to block.
	<div class="demo-element">Fade in and out</div>
</div>
CSS Code
.demo-area {
	width: 260px;
	min-height: 120px;
	padding: 12px;
	background: #f4f4f4;
	outline: 1px dashed #b0b0b0;
	font-size: 14px;
	color: #666;
}
.demo-area:hover .demo-element {
	display: block;
	opacity: 1;
}
@starting-style {
	.demo-area:hover .demo-element {
		opacity: 0;
	}
}
.demo-element {
	display: none;
	opacity: 0;
	margin-top: 10px;
	padding: 14px;
	background: #f72585;
	color: #fff;
	font-size: 15px;
	transition-property: opacity, display;
	transition-duration: 0.8s;
	transition-behavior: normal;
}

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

<div class="wrap">
<div class="box">Hover the dashed area: I fade out, then display: none</div>
</div>
.box {
  width: 220px;
  padding: 20px;
  background: #4361ee;
  color: #fff;
  font-family: system-ui, sans-serif;
  transition-property: opacity, display;
  transition-duration: 0.6s;
  transition-behavior: allow-discrete;
}

/* Hovering the wrapper hides the box: it fades out, then display flips */
.wrap:hover .box {
  opacity: 0;
  display: none;
}

@starting-style {
  .box { opacity: 0; }
}

.wrap {
  height: 100px;
  border: 1px dashed #bbb;
  padding: 10px;
}
Open in editor

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.

This property is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee