CSS Custom Properties

A presentation at JavaScript Meetup Luxembourg in in Luxembourg by Geoffrey Crofte

CSS Custom Properties

CSS Custom Properties

Geoffrey Crofte

Geoffrey Crofte

Overview

Overview

What are Custom Properties?

What are Custom Properties?

What are Custom Properties?

What are Custom Properties?

This not about

This not about

This is more about…

This is more about…

This is more about magic

This is more about magic

But this is not about currentColor neither

But this is not about currentColor neither

Custom Property definition

Custom Property definition

Custom Property definition

Custom Property definition

Custom Property definition

Custom Property definition

W3C Definition Extract

W3C Definition Extract

What the Spec says…

What the Spec says…

In other words…

In other words…

How to us CSS Variables?

How to us CSS Variables?

CSS Declaration

CSS Declaration

CSS Declaration v2

CSS Declaration v2

CSS Variable Use

CSS Variable Use

Quick Example of use

Quick Example of use

Why CSS instead of Sass Variables?

Why CSS instead of Sass Variables?

Computation

Computation

CSS Variables are alive

CSS Variables are alive

JavaScript can access them

JavaScript can access them

Media Queries ❤️ CSS  Variables

Media Queries ❤️ CSS Variables

Media Queries ❤️ CSS  Variables

Media Queries ❤️ CSS Variables

CSS Variables are inherited

CSS Variables are inherited

CSS Variables are inherited

CSS Variables are inherited

CSS Variables are inherited

CSS Variables are inherited

CSS Variables are inherited

CSS Variables are inherited

CSS Variables are inherited

CSS Variables are inherited

CSS Variables are inherited

CSS Variables are inherited

Demos & Use Cases

Demos & Use Cases

Mouse position

Mouse position

CSS Transformation

CSS Transformation

CSS Transformation

CSS Transformation

CSS Transformation

CSS Transformation

CSS Transformation

CSS Transformation

CSS Transformation

CSS Transformation

CSS Transformation

CSS Transformation

CSS Transformation

CSS Transformation

Now you're wondering…

Now you're wondering…

Now you're wondering…

Now you're wondering…

Now you're wondering…

Now you're wondering…

Now you're wondering…

Now you're wondering…

Now you're wondering…

Now you're wondering…

Another Wahou demo

Another Wahou demo

CSS Transformation

CSS Transformation

Themable interfaces

Themable interfaces

Themable interfaces

Themable interfaces

Themable interfaces code

Themable interfaces code

Themable interfaces code with variables

Themable interfaces code with variables

Themable interfaces code with variables

Themable interfaces code with variables

Accessibility Example

Accessibility Example

Accessibility Example

Accessibility Example

Responsive

Responsive

Responsive

Responsive

CSS Variables are CSS properties

CSS Variables are CSS properties

CSS Variables are CSS properties

CSS Variables are CSS properties

(kind of) Silent error

(kind of) Silent error

You can't "build up" values

You can't "build up" values

Strange behaviour

Strange behaviour

Fallbakc value

Fallbakc value

Fallback value

Fallback value

Fallback value

Fallback value

Fallback value

Fallback value

Fallback value

Fallback value

Fallback value

Fallback value

Fallback value

Fallback value

Fallback value

Fallback value

Variable as Fallback

Variable as Fallback

Variable as Fallback

Variable as Fallback

You can't cycle with variables

You can't cycle with variables

You can't cycle with variables

You can't cycle with variables

Support Testing

Support Testing

Compatibility and Support

Compatibility and Support

Polyfills

Polyfills

Some resources

Some resources

You now don’t have any excuses anymore: CSS brings custom properties to life, its own variables system, and they also have scope. No jealous! Let see together how to use them and some examples where JS and CSS variables are best friends forever.

Resources

The following resources were mentioned during the presentation or are useful additional information.

Buzz and feedback

Here’s what was said about this presentation on social media.