function
sign() — CSS reference
Return a unitless -1, 0 or 1 according to the sign of the resolved input; the calculation model also preserves signed zero and propagates NaN. The sign of a percentage may depend on its resolution basis.
Formal Syntax & Structure
css syntaxcss
sign(<calc-sum>)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 {margin-left: calc(20px * sign(-2px))} #b {margin-left: calc(20px * sign(2px))}</style><body><div class="parent"><div id="a" class="sample"></div><div id="b" class="sample"></div></div></body></html>