![]() |
VOOZH | about |
LESS (Leaner Style Sheets) is a CSS preprocessor that extends CSS with dynamic behavior, including variables, nesting, mixins, and mathematical operations, all while maintaining compatibility with standard CSS.
A browser cannot directly process LESS code. A LESS preprocessor compiles the LESS file into standard CSS that browsers can interpret.
Here is a list of all the features of LESS, each explained one by one:
1. Variables: Variables can be used to store CSS values that may be reused. They are initialized with @.
Syntax: To compile the above less code to CSS code write the following command-
lessc style.less style.cssThe compiled CSS file comes to be:
2. Mixins: Mixins are a way of including a bunch of properties from one rule-set into another rule set.
Syntax: To compile the above less code to CSS code write the following command-
lessc style.less style.cssThe compiled CSS file comes to be:
3. Nesting: LESS gives you the ability to use nesting.
Syntax: To compile the above less code to CSS code write the following command-
lessc style.less style.cssThe compiled CSS file comes to be:
4. Mathematical Operations: Arithmetical operations +, -, *, / can operate on any number, color, or variable.
Syntax: To compile the above less code to CSS code write the following command-
lessc style.less style.cssThe compiled CSS file comes to be:
5. Functions: LESS provides a variety of functions like math, list, string, color operations, color blending, etc.
Syntax: To compile the above less code to CSS code write the following command-
lessc style.less style.cssThe compiled CSS file comes to be:
Example: File name gfg.html
Output: