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.

Advertisements