Animate details & summary with a few lines of CSS

Kevin Powell on YouTubeWatch on YouTube

SaveMark complete

Sign in to save videos and track what you’ve finished.

IntermediateUI13 min

About this video

A CSS tutorial showing how to animate the opening and closing of HTML details and summary elements using modern CSS features. It covers the HTML and basic styling, interpolate-size, the ::details-content pseudo-element, and fixing the closing transition, noting that browser support is still progressive.

What you’ll learn

  • Animate the opening and closing of a details element with CSS
  • Use interpolate-size to transition to auto height
  • Style the ::details-content pseudo-element for smooth transitions