Using CSS custom properties like this is a waste

Kevin Powell on YouTubeWatch on YouTube

SaveMark complete

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

IntermediateUI16 min

About this video

Kevin Powell shows how to go beyond declaring CSS custom properties on :root by setting up locally scoped custom properties, so one value can be changed and new variations created with less repeated code. It is aimed at developers who already write CSS.

What you’ll learn

  • Set up locally scoped CSS custom properties with defaults
  • Change a single value instead of redeclaring properties
  • Create new component variations with less repeated code