![]() |
VOOZH | about |
LESS is a simple CSS pre-processor that makes it possible to create manageable, customizable, and reusable style sheets for websites. LESS is a dynamic style sheet language that increases the working power of CSS. LESS is cross-browser compatible. CSS pre-processor is a scripting language that improves CSS and gets compiled into regular CSS syntax so that the web browser can use it. This also provides functionalities like variables, functions, mixins, and operations that enable us to build dynamic CSS.
Why use LESS?
LESS was originally designed by Alexis Sellier in the year 2009. LESS is an open-source language easy to learn and understand. The very first version of LESS was written in Ruby. While, in the next versions, the use of Ruby was replaced by a more simple language JavaScript.
LESS features:
Advantages of LESS:
Disadvantages of LESS:
Let's see some examples of less-
Syntax:
@primary:green; @text:black; @color:white;
Example 1: The following example demonstrates the use of less -
index.html
Next, create the less file-
style.less
To compile the less file to a CSS file, write the following command.
lessc style.less style.css
Execute the above command, it will create the "style.css" file automatically with the following code.
Output:
Example 2: The following example demonstrates the use of mixin in less -
Index.html
Now, create the less file -
style.less
To compile the less file to a CSS file, write the following command.
lessc style.less style.css
Execute the above command, it will create the "style.css" file automatically with the following code.
style.css
Output:
Reference: https://lesscss.org/