2. What is LESS?
What is LESS?
- LESS=The dynamic stylesheet language.
- LESS extends the standard CSS syntax. This means that you can create a LESS
stylesheet using regular CSS, and just add LESS code to the stylesheet as and
when you need it.
3. Processing
Processing
- The LESS compiler is written in JavaScript.
- The compiler converts your LESS code into CSS when the browser loads the
page
4. Why LESS?
- LESS has everything that CSS is missing.
- Features:
1- Variables
2- Mixins
3- Nested rules
4- Operators and functions
5. Variables
- When you program you can set a constant variable that you can access throughout
your program.
- You can do the same with LESS. Set a variable named @red, add your favorite
hex red color and use it in your stylesheet.
- Wanna change the color a bit? Just change the @red value and smile
7. Mixins
- allow you to embed all the properties of a class into another class by simply
including the class name as one of its properties.
Ex:
// LESS
.rounded-corners (@radius: 5px) {
border-radius: @radius; -webkit-border-radius: @radius;
-moz-border-radius: @radius;
}
#header {
.rounded-corners;
}
#footer {
.rounded-corners(10px);
}
9. Nested rules
- You can simply nest selectors inside other selectors.
- These can save you a lot of coding, and they make your code clearer.
Bye bye long selectors!