Editor's Draft · css-variables

CSS Custom Properties for Cascading Variables

1 function defined by this specification, all known to at least one browser .

The feature in detail

var()

Function Baseline: widely availablesince October 2019

MDN The var() CSS function can be used to insert the value of a custom property (sometimes called a "CSS variable") instead of any part of a value of another property.

Live preview Example from MDN
:root {
  --color-a: pink;
  --color-b: green;
  --color-c: rebeccapurple;
}

#example-element {
  border: 10px solid black;
  padding: 10px;
}

Syntax

var( <custom-property-name> , <declaration-value>? )

Formal grammar from the specification, as webref extracts it: the latest level's definition, sometimes ahead of what browsers implement.

Browser support

First browser version supporting var()
Chrome 49
Edge 15
Firefox 31
Safari 9.1
Chrome Android 49
Safari iOS 9.3

First version with support, from MDN browser-compat-data.