Module lessons (3/4)
Animating Top Layer Panels With @starting-style
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: noneused to snap onto screen without CSS entry animation. - Use
@starting-styleandtransition-behavior: allow-discretecleanly for smooth<dialog open>and[popover]:popover-openentrances. - 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
- 1Why
display: noneElements Didn't Animate Before
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.