Published On Apr 14, 2022
A common problem people ask me about is animating from, or to display: none, since it's not an animatable property.
After making my recent video on the dialog element, I got a lot of questions about animating it in and out, and it just so happens to use `display: none` when it's closed, so I saw it as a good opportunity to take a look at it.
🔗 Links
✅ The video on the dialog element: • dialog = the easiest way to make a po...
✅ The CodePen: https://codepen.io/kevinpowell/pen/QW...
✅ Open Props: https://open-props.style/
✅ Video introducing Open Props: • Supercharge your CSS with Open Props
⌚ Timestamps
00:00 - Introduction
01:32 - What we're starting with
01:59 - Adding the animation on open
02:52 - The problem with backdrop
03:53 - Getting the backdrop to fade in
04:31 - Why it's easy to animate on open but not on close
05:28 - A quick fix for animating the close
06:37 - the problems with this solution
08:37 - Making a "closing" state
09:15 - Making the closing state work
14:06 - The problem with different animations on close
15:01 - Closing when we click outside the modal
19:36 - fixing the backdrop shadow effect
#css
--
Come hang out with other dev's in my Discord Community
💬 / discord
Keep up to date with everything I'm up to
✉ https://www.kevinpowell.co/newsletter
Come hang out with me live every Monday on Twitch!
📺 / kevinpowellcss
---
Help support my channel
👨🎓 Get a course: https://www.kevinpowell.co/courses
👕 Buy a shirt: https://teespring.com/stores/making-t...
💖 Support me on Patreon: / kevinpowell
---
My editor: VS Code - https://code.visualstudio.com/
---
I'm on some other places on the internet too!
If you'd like a behind the scenes and previews of what's coming up on my YouTube channel, make sure to follow me on Instagram and Twitter.
Twitter: / kevinjpowell
Codepen: https://codepen.io/kevinpowell/
Github: https://github.com/kevin-powell
---
And whatever you do, don't forget to keep on making your corner of the internet just a little bit more awesome!