Originally published at: http://www.sitepoint.com/understanding-sass-units/

## Understanding Sass Units

I have written about units in Sass in the past for my own blog, and not so long ago as a CSS-Tricks Sass snippet, but given how often I notice confusion and misconception about the way units work in our beloved preprocessor, I thought a full length article would not be such a bad idea after all.

After two years of writing and reading Sass code every day, I must say that snippets, articles and library code misusing Sass units are beyond counting. I have been guilty of this myself in the past, and I have witnessed Sass core designers trying to teach developers to properly use Sass units more than once.

This battle is obviously not over so letâ€™s hope this article will be the *coup de grace*, in some way.

### Units in real life

Before considering code, I think it is important to understand how numbers and units behave in real life. You may not have noticed this yet, but there are very few numbers we use in our daily life that do not have a unit. When we say â€śspeed limit is 50â€ł, we implicitly mean â€ś50 kilometers per hourâ€ť; in this case the unit is *km/h*. When we say â€ślook, eggs! Iâ€™ll have a dozen of thoseâ€ť, the unit is *eggs*: a dozen of eggs. There are exceptions of course but most usages of numbers in our daily routine usually involve a unit.

Along the same lines, running mathematical operations on numbers with units follow some rules. For instance, there are reasons why an area of 5 meters per 5 meters gives 25 square meters (`mÂ˛`

). Same for a cube of 1 meter side: it has a volume of 1m^{3} because 1 meter per 1 meter per 1 meter doesnâ€™t give 3 meters, but 1 cubic meter.

I like how Chris Eppstein puts it:

Continue reading this article on SitePoint