The {less} language
The Less language is a preprocessor for CSS. This means that one can construct CSS much easier
than hand crafting. For example, consider the following simple CSS:
.class1 {
color: red;
}
.class2 {
color: red;
}
If we wished to change our color, we would have to manually change our CSS file. A simple find
and replace may catch too much. However, using Less, we can specify variables, for example:
@myColor: red;
.class1 {
color: @myColor;
}
.class2 {
color: @myColor;
}
See also:
• The {less} language
Variables
Variables are defined as:
@name: value;
They are referenced in CSS with "@name"
Mixins
A class defined in CSS can be "embedded" or mixed in with another class by using the class in the
body. For example:
.myClass1 {
...
}
.myclass2 {
…
.myClass1;
}
Nesting
Definitions can be nested.
Operations
Addition and subtraction operations can be applied to colors and size units.
Timer based functions
From time to time, we may have a need for a function to be executed either after a period or time or
at regular intervals. The browser environment provides this capability through the "window"
object. There are two functions of interest to us:
Page 132
Comentários a estes Manuais