Skip to main content
Module 13 · Lesson 3 of 451/60 in the course~19 min
Module lessons (3/4)

Animating Top Layer Panels With @starting-style

Lesson preview5 hands-on exercises readyModern HTML & CSS · Top Layer UI, Popovers & Modern Forms

Smoothly fade in newly shown popovers and open dialogs using @starting-style, allow-discrete display transitions, and reduced-motion guards.

What you'll learn in this lesson

  • Understand why elements transitioning out of display: none used to snap onto screen without CSS entry animation.
  • Use @starting-style and transition-behavior: allow-discrete cleanly for smooth <dialog open> and [popover]:popover-open entrances.
  • Guard entrance transforms cleanly inside @media (prefers-reduced-motion: reduce).

Overview

CSS transitions need a before state and an after state computed on separate style frames. Historically, flipping an element from display: none to display: block (such as opening <dialog open> or a [popover]) meant the browser had zero initial computed opacity or transform frame to transition from.

Modern CSS solves both halves cleanly without any JavaScript requestAnimationFrame timeout hacks:

Sections covered in this lesson

  1. 1Why display: none Elements Didn't Animate Before
Pro Lesson · Top Layer UI, Popovers & Modern Forms

Unlock "Animating Top Layer Panels With @starting-style" and the full Modern HTML & CSS curriculum

Smoothly fade in newly shown popovers and open dialogs using @starting-style, allow-discrete display transitions, and reduced-motion guards.

Unlock all 5 hands-on exercises in this lesson plus every advanced WebAssembly module with automated checks.

  • Instant access to all advanced modules in Modern HTML & CSS plus 17 more courses
  • Hands-on browser exercises with automated test suites and solutions
  • 14-day money-back guarantee processed via Paddle.com

14-day guarantee · Cancel anytimeModule 1, all 18 interactive games, and cheatsheets are always free.