© Alex Libby 2019
Alex LibbyIntroducing Dart Sasshttps://doi.org/10.1007/978-1-4842-4372-5_4

4. Calculating Values Using Operations

Alex Libby1 
(1)
Rugby, Warwickshire, UK
 

One of the key benefits to using Sass is the ability to calculate values dynamically – I don’t just mean by using something like percentage values, but working out values using operators such as addition or subtraction.

Yes, you read correctly – using math! Now, before you run for the hills, this isn’t as crazy as it may seem: we can already write statements such as font: 10px/8px; in our code. As Sass is an extension of CSS, Sass not only supports this, but takes it to a whole new level. The great thing about this though is that the math involved does not have to be complicated ...

Get Introducing Dart Sass: A Practical Introduction to the Replacement for Sass, Built on Dart now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.