Abstract
When writing CSS, we frequently create static rules for similar elements - while this works, it is certainly not the most efficient way of writing code! What if we could take it up a notch, and use maths to create our values dynamically?
Yes, you heard correctly: using maths! Before you run for the hills, this isn’t as crazy as it may seem - rather than have to manually work out the sizes of elements in a responsive layout, for example, we can instead use simple operators in Sass to work this out for us automatically. This is just one way of using basic maths in Sass, which makes it a really powerful tool - over the course of this chapter, we’ll work through some simple examples of maths that can really help save you time when it comes to developing in Sass.
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsAuthor information
Authors and Affiliations
Rights and permissions
Copyright information
© 2019 Alex Libby
About this chapter
Cite this chapter
Libby, A. (2019). Calculating Values Using Operations. In: Introducing Dart Sass. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-4372-5_4
Download citation
DOI: https://doi.org/10.1007/978-1-4842-4372-5_4
Published:
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4842-4371-8
Online ISBN: 978-1-4842-4372-5
eBook Packages: Professional and Applied ComputingProfessional and Applied Computing (R0)Apress Access Books