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

css custom properties variables what css variables are
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

CSS CUSTOM PROPERTIES (VARIABLES)

slide-2
SLIDE 2

What CSS Variables are?

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

slide-3
SLIDE 3

How to use a variable?

  • -my-variable

var(--my-variable);

slide-4
SLIDE 4

BENEFITS

  • Easier to update
  • Easier to read
  • Reduce the amount of typing
slide-5
SLIDE 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

  • r javascript
slide-6
SLIDE 6

CSS VARIABLES IN JAVASCRIPT

root.style.setProperty('--mouse-x', 56 + “px”);

slide-7
SLIDE 7

BROWSER SUPPORT

slide-8
SLIDE 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

slide-9
SLIDE 9

THANK YOU!!!!!