concept
custom-property — CSS reference
Custom properties are case-sensitive author-defined properties that participate in the cascade. Unregistered custom properties inherit by default and hold CSS tokens rather than a prevalidated length or color. Components can override inherited values locally.
Formal Syntax & Structure
css syntaxcss
--name: <declaration-value>; width: var(--name);Working Example
Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>CSS substitution lab</title><style>body {margin:0} .sample {height:12px;background:#006050}#parent {width:300px} .sample {width:40px;height:30px;margin-bottom:4px;color:white}#parent{--size:70px} .sample{width:var(--size)} #b{--size:90px}</style><body><div id="parent"><div id="a" class="sample">A</div><div id="b" class="sample">B</div></div></body></html>