data-type

<calc-sum> — CSS reference

The grammar describes additive expressions formed from products, which may themselves contain numeric values, constants and parenthesized expressions. This is a grammar production, not a literal string to paste into a declaration. The binary plus and minus tokens need surrounding whitespace.

Formal Syntax & Structure

css syntaxcss
<calc-sum> = <calc-product> [ [ + | - ] <calc-product> ]*

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(10px + 20px * 3)} #b {width: calc((10px + 20px) * 3)}</style><body><div class="parent"><div id="a" class="sample"></div><div id="b" class="sample"></div></div></body></html>
CSS Reference