css custom properties variables what css variables are
play

CSS CUSTOM PROPERTIES (VARIABLES) What CSS Variables are? CSS - PowerPoint PPT Presentation

CSS CUSTOM PROPERTIES (VARIABLES) What CSS Variables are? CSS variables are entities defined by CSS authors that contain specific values to be reused throughout a document. How to use a variable? --my-variable var(--my-variable); BENEFITS


  1. CSS CUSTOM PROPERTIES (VARIABLES)

  2. What CSS Variables are? CSS variables are entities defined by CSS authors that contain specific values to be reused throughout a document.

  3. How to use a variable? --my-variable var(--my-variable);

  4. BENEFITS ● Easier to update ● Easier to read ● Reduce the amount of typing

  5. PURE CSS VARS VS PREPROCESSOR VARS ● Preprocessor vars are impossible to spot in compiled code ● Preprocessor vars are static, that means that you can't change them through media queries or javascript

  6. CSS VARIABLES IN JAVASCRIPT root.style.setProperty('--mouse-x', 56 + “px”);

  7. BROWSER SUPPORT

  8. SOURCES ● https://medium.com/playgroundinc/css-custom -properties-are-here-383693c05ecb ● https://developer.mozilla.org/en-US/docs/Web/ CSS/Using_CSS_variables#Values_in_JavaScri pt

  9. THANK YOU!!!!!

Recommend


More recommend