a bitmoji of Dre Wilson.

How To Use Native CSS Variables

In this video, I’ll show you how to use CSS custom properties or variables. Then I’ll show how you can access the variable values in JavaScript, and how to change the values in JavaScript.

 

Intro: 0:00
Basic Example: 1:02
Getting CSS Variable Value In JavaScript: 5:19
Setting a CSS Variable in JavaScript: 7:24

 

Custom Variables Documentation from MDN 👉🏾 https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties

document.documentElement documentation from MDN 👉🏾 https://developer.mozilla.org/en-US/docs/Web/API/Document/documentElement

Comments