style.setProperty()

DOM methods for writing and reading a single CSS property, including custom properties, on an element's inline style.

In more detail

element.style.setProperty("--sys-bg", "#111") changes a custom property at runtime, and getPropertyValue reads it back. The lesson uses them to swap themes on an element without rebuilding any stylesheet.

Related terms

Taught in

References