Introducing functions

Another useful feature of Less is its ability to work out values that should be used in CSS, as a result of calculating the answers to functions and not merely using static values.

If you are already familiar with functions in programming, you might think that using functions in Less will involve writing lots of complicated formulae. Before you put your hands up in horror, fear not—it doesn't have to be that complicated! In this section, we're going to take a look at how you can use some simple math functions to automatically calculate values, using operators and the data-uri function as the basis for some examples of the many functions available within Less.


You can see the complete list of functions, on the main website ...

Get Learning Less.js 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.