Making sense of starting-style
Published on:@starting-style
is a CSS at-rule that allows you to create transitions for elements that are hidden by display:none
.
It's one of those things that seems simple on first glance, but turns out to be quite complex. The main reason is because we can't DRY (Don't Repeat Yourself) when using @starting-style
— you have to specify certain styles twice.
Making sense of starting style is actually pretty simple. You have to write three selectors:
- One for the base state
- One for the opened state
- One for the starting state