CSS transition-behavior Generator

✨ CSS transition-behavior Generator Zero Dependencies·Offline

Free online CSS transition-behavior generator. Generate allow-discrete transition code to enable CSS transitions on display and other discrete properties. Pure frontend processing.

Waiting...
Shortcuts: Ctrl+Enter Generate | Ctrl+Shift+C Copy | Ctrl+Shift+X Clear

What can the CSS transition-behavior Generator do?

The CSS transition-behavior Generator is a free online tool that helps frontend developers quickly generate transition-behavior: allow-discrete code. allow-discrete enables CSS transitions on discrete properties like display, and combined with @starting-style, achieves smooth transitions from hidden to visible states. Pure frontend processing, no server uploads.

Core Features

How to Use

  1. Select preset scenario: Choose from modal, dropdown and other templates
  2. Configure selector: Enter CSS selector and show state
  3. Set transition properties: Check opacity, transform, display etc.
  4. Adjust parameters: Set duration, easing function, transform direction
  5. Generate code: Click generate and copy code to your project

Use Cases

Case 1: Modal Enter Animation

When a modal transitions from display:none to display:block, combine allow-discrete and @starting-style for a fade-in + slide-up enter animation without JavaScript.

Case 2: Dropdown Menu Expansion

When a dropdown expands, display participates in the transition, combined with opacity and transform for an elegant expansion effect.

Case 3: Notification Slide-In

Notifications transitioning from hidden to visible use allow-discrete for smooth display transitions, combined with transform for slide-in effects.

Technical Background

CSS transition-behavior is part of the CSS Transitions Level 2 specification, implemented in Chrome 117 in 2023. It solves a fundamental CSS transition limitation: discrete properties like display cannot participate in transitions. In the traditional approach, display:none to display:block changes are instantaneous and cannot sync with animatable properties like opacity. allow-discrete changes this behavior: during the transition, display keeps the target value, switching only when the transition ends. Combined with @starting-style for defining the starting state of enter animations, this achieves a pure CSS "enter animation" solution that is simpler and better performing than JavaScript alternatives.

❓ FAQ

What is CSS transition-behavior?

transition-behavior is a CSS property that controls whether discrete properties like display participate in transition animations. When set to allow-discrete, display can transition smoothly.

What are discrete properties?

Discrete properties are CSS properties with no intermediate states between values. display:none to display:block cannot be interpolated. allow-discrete enables transitions for such properties.

How does allow-discrete work?

With allow-discrete, display keeps the target value during the transition, switching only when the transition ends. Combined with @starting-style you can define the starting state for enter animations.

What is browser compatibility?

Chrome 117+, Edge 117+, Safari 17.4+ support it. Firefox is implementing. Use @supports for detection.

Must it be used with @starting-style?

Not required, but recommended. allow-discrete alone only lets display participate in the transition list. With @starting-style you can define the starting state for enter animations.

Which discrete properties are supported?

Currently mainly the display property. visibility is also discrete but already has special transition handling. More may be supported in the future.

CSS transition-behavior Generator | No Signup, Client-Side · No Server Uploads

Feedback: dexshuang@google.com