19Understanding Value Types in Sass

Everything we write in Sass, from classes to pixel widths, can be considered a value. However, values can be of different types. This makes some aspects of them incompatible, and learning about their differences is essential for writing more complex Sass. In some cases, it’s possible to convert from one value type to another with some special Sass functions. In this task, you’ll learn about the types of values found in Sass, plus some conversion functions.

Numbers are pretty self-explanatory. Any time you write a digit in Sass, that’s of the number type—even if it has a unit associated with it. So 12, 59.7%, and 200px are all numbers.

Colors are also straightforward. They can be hex values (for example, ...

Get Pragmatic Guide to Sass 3 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.