16.9 Operators
As briefly mentioned in the previous section, you can also use the calculation operators +, -, *, /, and % (modulo) with Sass. It can be quite useful to have the values calculated during the design and layout. Here’s an example that demonstrates a few ways you can use operators in Sass. I used this example in the context of media queries and adjusted a few properties with simple calculations.
Table 16.11 The SCSS File and the CSS File after the Preprocessor Run
These examples don’t really need much more description. The usual rules such as “multiplication and division before addition and subtraction” apply here as well. You may be a bit surprised by the notation $base-size * 1em because it only calculates 1 × 1. This is necessary here because the $base-size variable has no unit, and this way we set the unit em. This wasn’t necessary for $base-size + $font-increase because $font-increase was assigned the unit em.