Skip to content

Files

Latest commit

6b5b78f · Feb 14, 2019

History

History

03 - Playing with CSS Variables and JS

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Jan 27, 2019
Feb 14, 2019
Jan 27, 2019

Playing with CSS Variables and JS

Playing with CSS Variables and JS

Changing CSS variables with JavaScript.

Notes

CSS

  • CSS variables (actually CSS custom properties) can be used to assign values for later use in other properties.
  • filter property applies various graphical effects like blur or contrast to an element.

JavaScript

  • We used two new events. change which will be trigered when a value input changes and mousemove which trigers when you move the mouse on the element.
  • data attributes can be accessed using the HTMLelement.dataset in javascript.
  • We can change the variables that we have defined on the :root element with document.documentElement.style.setProperty()

References