This custom property trick solves a common CSS problem @KevinPowell
This custom property trick solves a common CSS problem  @KevinPowell
Uploaded April 2025 | Updated November 2026, 3 hours ago
Having to worry about browser support stinks, but thanks to a simple custom property trick, there’s a really easy way to create fallbacks for older browsers.

πŸ”— Links
βœ… Josh’s website: joshwcomeau.com
βœ… Josh’s Bluesky Post that I mention: https://bsky.app/profile/joshwcomeau.com/post/3li3r6i7dac2w
βœ… Easing Wizard: easingwizard.com
βœ… Final Code from this video: codepen.io/kevinpowell/pen/vEYvBJd
βœ… Animating/Transitioning to and from height auto:
βœ… I’ve got free and premium courses: kevinpowell.co/courses

⌚ Timestamps
00:00 - Introduction
00:10 - What we’re starting with
00:40 - Using the cascade to our advantage
03:00 - You can’t have a fallback to the custom property as a fallback behaviour
05:33 - Josh’s post
05:08 - Using custom properties to make this much easier
07:18 - Different transitions in different directions
08:12 - Other use cases for this

#css

βœ‰ Keep up to date with everything I'm up to kevinpowell.co/newsletter
πŸ’¬ Come hang out with other devs in my Discord Community discord.gg/nTYCvrK
⭐ Are you a beginner? HTML & CSS for absolute beginners is for you: learn.kevinpowell.co
πŸŽ“ Start writing CSS with confidence with CSS Demystified: [https://cssdemystified.com](https://cssdemystified.com/)
πŸš€ Already mastered CSS? Check out my advanced course, Beyond CSS: https://www.beyondcss.dev/

---

Help support my channel
πŸ‘¨β€πŸŽ“ Get a course: kevinpowell.co/courses
πŸ‘• Buy a shirt: cottonbureau.com/people/kevin-powell
πŸ’– Support me on Patreon: patreon.com/kevinpowell or through YT memberships: youtube.com/@KevinPowell/join

---

πŸ§‘β€πŸ’» My editor: VS Code - code.visualstudio.com

🌈 My theme: One Dark Pro Var Night
πŸ”€ My font: Cascadia Code

---

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:

Bluesky: https://bsky.app/profile/kevinpowell.co
Codepen: codepen.io/kevinpowell
Github: 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!
This custom property trick solves a common CSS problemCan I recreate this animated gradient button?CSS Attribute SelectorsThis CSS property fixes a problem as old as CSS - a look at text-box-trim and text-box-edgeThis blew my mindI challenged a CSS Wizard to a CSS BattleEverybody is dead!Stop using rgba() and hsla()A simple shift to better understand CSSLet CSS figure out the layoutStart by over-engineeringStop using the legacy color syntax
Kevin Powell |

This custom property trick solves a common CSS problem

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER