calc
is a CSS3 function that provides the possibility to do simple math in CSS (add, subtract, divide, multiply). Without spaces
around operators, calc
will have no effect.
More precisely, before an operator, there must be a single whitespace or a newline plus indentation. After an operator, there must be a single
whitespace or a newline.
Noncompliant code example
#div1 {
position: absolute;
width: calc(100%- 100px); /* Noncompliant; no space after the % sign */
}
Compliant solution
#div1 {
position: absolute;
width: calc(100% - 100px);
}