data-type

<calc-keyword> — CSS reference

These case-insensitive constants are number-like operands in math functions. e and pi approximate mathematical constants; infinity and NaN represent exceptional floating-point results. An outermost calculation resolves NaN to zero and infinities are clamped to the supported range for the destination; this is not the same as rejecting the declaration. Use finite expressions where possible.

Formal Syntax & Structure

css syntaxcss
e | pi | infinity | -infinity | NaN

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>CSS math lab</title><style>body {margin:0} .sample {height:12px;background:#006050}.parent {width:300px} .sample {width:40px;margin-bottom:4px} #a {width: calc(pi * 10px)} #b {width: calc(NaN * 1px)}</style><body><div class="parent"><div id="a" class="sample"></div><div id="b" class="sample"></div></div></body></html>
CSS Reference