Interview :: Less
The Learner Style Sheet (Less) is a backward-compatible language that can be compiled into the Cascading Style Sheet (CSS) and runs on both the client side and server side. It is an open source language and cross-browser compatible.
The Less programming language was first invented in 2009.
The LESS was first written in Ruby in 2009.
Currently, Less is using JavaScript.
The Less is designed and developed by Alexis Sellier and Dmitry Fadeyev.
The ".less" is the extension of the Less file. It is always required to use ".Less" extension in Less document file.
There are three ways to use Less:
- Through the command line.
- Through a third-party tool.
- You can download Less as a script file for the browser.
It is required to declare a variable with @ symbol and uses a colon (:) to assigned the particular value in the variable. It is also necessary to add a semi-colon (;) after the value of the variable.
For example:
In the above example of Less, the two variables used in the Less programming having values #FF7F50 and #800080.
In Less, Mixins facilitates you to add the set of properties from one rule-set into another rule-set. It includes class names as its properties. Mixins can be declared as the same way as CSS style using a class or id selector. It can store multiple values and can be reused in the code whenever necessary.
Syntax:
The nesting is used to make the code simple, clean and Less complicated by allowing it to follow some visual hierarchy. For example nesting of classes can be done in Less programming.
For example:
In the above Less document example of nesting myclass is the subclass of container class.