descriptor

@property/syntax — CSS reference

The syntax descriptor is a string defining the accepted grammar of a registered property. Supported types, literal keywords, alternatives and multipliers form a restricted grammar, not all of CSS value definition syntax. The universal syntax "*" accepts arbitrary declaration tokens. Invalid typed values default according to registration.

Formal Syntax & Structure

css syntaxcss
syntax: "<length> | <percentage>";

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}@property --size{syntax:"<length> | <percentage>";inherits:false;initial-value:15px} .sample{width:var(--size)} #a{--size:25%} #b{--size:red}</style><body><div id="parent"><div id="a" class="sample">A</div><div id="b" class="sample">B</div></div></body></html>
CSS Reference