MDN self-hosted library · e01.org

CSS Properties and Values API

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

js
window.CSS.registerProperty({
  name: "--my-color",
  syntax: "<color>",
  inherits: false,
  initialValue: "#c0ffee",
});
css
@property --my-color {
  syntax: "<color>";
  inherits: false;
  initial-value: #c0ffee;
}