[Frontend Development]PUBLISHED 2026-11-25//4 min read//VERIFIED 2026-11-25

CSS Entry and Exit Transitions with @starting-style and Discrete Properties

Animate elements that appear or disappear with CSS while keeping their display and top-layer lifetimes correct.

EXECUTIVE ARCHITECTURAL OVERVIEW

CSS transitions normally need a previous rendered style to interpolate from. The @starting-style at-rule supplies an initial state for newly displayed elements, while transition-behavior: allow-discrete enables discrete changes such as display to participate in entry and exit transitions.

THE PRODUCTION PROBLEM STATEMENT

A popover that changes from display:none to visible has no prior rendered frame for a standard transition. Even when opacity animates in, the element can disappear immediately on close unless its display and top-layer state are retained through the exit.

SECTION 01 //

Define a starting state for first display

Set the visible style in the normal open selector, then set the initial opacity and transform in @starting-style. The starting rule is used when the element first becomes rendered, including a transition out of display:none.

Keep the base closed state explicit. The transition needs a closed state, an entry state, and an open state to describe both directions.

popover-transition.css
.panel[popover] {
  opacity: 0;
  transform: translateY(-0.25rem);
  transition: opacity 180ms, transform 180ms,
    display 180ms allow-discrete,
    overlay 180ms allow-discrete;
}

.panel[popover]:popover-open {
  opacity: 1;
  transform: translateY(0);
}

@starting-style {
  .panel[popover]:popover-open {
    opacity: 0;
    transform: translateY(-0.25rem);
  }
}
Keep a popover rendered long enough for both its entry and exit transition.
SECTION 02 //

Understand discrete display and overlay transitions

Display and overlay do not interpolate like opacity. The allow-discrete behavior tells the browser how to switch discrete values while the continuous properties animate. For top-layer elements, delaying overlay removal can keep the element available through its closing transition.

Verify the browser versions you support. A feature check or a non-animated fallback is safer than assuming support based on one browser.

SECTION 03 //

Keep reduced motion and state changes in scope

Use short transitions and respect prefers-reduced-motion. Do not depend on an animation finishing to save application data or perform cleanup; visual transitions may be interrupted by navigation, a tab closing, or a change in user preference.

Avoid animating large page regions or layout-heavy properties. Entry and exit motion works best as a small cue for a panel whose functional state is already correct.

TECHNICAL INQUIRY MATRIX

Frequently Asked Questions & Technical Inquiries

Direct, practical answers to common architectural and debugging questions.

A transition needs a starting value. A newly rendered element has no earlier rendered style, so @starting-style supplies one for the first transition.

Official References & Specifications:
Faisal Askari

Faisal Askari

Verified Author

Software Engineer & Full-Stack Developer

Personal Website

Faisal Askari is a software engineer with deep expertise in web systems architecture, the JavaScript runtime ecosystem, and client-side performance engineering. Over years of hands-on production engineering, he has designed and shipped enterprise dashboards, high-converting digital interfaces, and specialized full-stack applications.

SPEC // VERIFIED ENTITY•Karachi, Pakistan (Global Remote)
contact@faisalaskari.top
05/RELATED ENGINEERING GUIDES
CONTINUE STUDY