@KevinPowell
  @KevinPowell
Kevin Powell | Using CSS custom properties like this is a waste @KevinPowell | Uploaded October 2023 | Updated October 2024, 1 hour ago.
If you're interested in checking out ICodeThis, you can find it here: icodethis.com/?ref=kevin and if you want to sign up for one of their premium plans, use KEVIN at checkout for an extra 10% off.

Custom properties are amazing, but a lot of people don’t take advantage of how awesome they are. They set them up in the :root and that’s it, but they can be so much more useful than that! So, in this video I explore how we take them up a notch and make our code a lot more efficient in the process.

πŸ”— Links
βœ… ICodeThis: icodethis.com/?ref=kevin
βœ… Lea Verou’s article on pseudo-private properties: lea.verou.me/blog/2021/10/custom-properties-with-defaults
βœ… The starting code from this video: codepen.io/kevinpowell/pen/QWzZaMz
βœ… The final code from this video: codepen.io/kevinpowell/pen/RwEqEyV

Disclaimer: Some of the links above might be affiliate links, which means that I'll receive a commission in case you like and decide to purchase the product or service. This comes at no extra cost for you, and helps support my channel 😊

⌚ Timestamps
00:00 - Introduction
01:45 - Setting up locally scoped custom properties
07:30 - Why this is so useful
11:00 - iCodeThis
11:40 - Changing one value instead of redeclaring property
14:10 - Creating new variations is so easy

#css

--

Come hang out with other dev's in my Discord Community
πŸ’¬ discord.gg/nTYCvrK

Keep up to date with everything I'm up to
βœ‰ kevinpowell.co/newsletter

Come hang out with me live every Monday on Twitch!
πŸ“Ί twitch.tv/kevinpowellcss

---

Help support my channel
πŸ‘¨β€πŸŽ“ Get a course: kevinpowell.co/courses
πŸ‘• Buy a shirt: teespring.com/stores/making-the-internet-awesome
πŸ’– Support me on Patreon: patreon.com/kevinpowell

---

My editor: VS Code - 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: twitter.com/KevinJPowell
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!
Using CSS custom properties like this is a wasteLearn by copying, not copying & pastinghsl() is great, but this is even better!7 resources to help you practice your front-end skillsOne small tweak to instantly improve your gradientsFix ugly text wrapping with this simple CSS trickI just wasted a day on this code, was it worth it?Flexbox or Grid challenge // which would you use to solve these?Astro makes websites faster & easier to buildQuick guide to CSS focus statesVery small CSS tweaks for better formsWhat would you call this layout?

Using CSS custom properties like this is a waste @KevinPowell

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER