function

env() — CSS reference

Insert a user-agent-defined environment value, optionally with indexes for indexed variables. Unlike custom properties, environment variables are globally scoped and not set through ordinary author declarations. Fallback handles a missing variable, not an existing zero.

Formal Syntax & Structure

css syntaxcss
env(<environment-variable-name> <integer>* [, fallback])

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}#a{width:env(bytemind-unknown-environment,42px)} #b{width:calc(50px + env(bytemind-unknown-environment,12px))}</style><body><div id="parent"><div id="a" class="sample">A</div><div id="b" class="sample">B</div></div></body></html>
CSS Reference