LESS Tutorial on LESS Variables

in this chapter, we will discuss the variables in less. less allows variables to be defined with an @ symbol. the variable assignment is done with a colon(:).

the following table demonstrates the use of less variables in detail.

sr.no. variables usage & description
1 overview

repetition of same value many times can be avoided by the use of variables.

2 variable interpolation

the variables can also be used in other places like selector names, property names, urls and @import statements.

3 variable names

we can define variables with a variable name consisting of a value.

4 lazy loading

in lazy loading, variables can be used even when they are not.

5 default variables

default variable has an ability to set a variable only when it is not already set. this feature is not required because variables can be easily overridden by defining them afterwards.