Variables

Among the most valuable LESS features, there is variable support. This is a brief example of what we can do with it:

// Variables can be declared as such: 
@link-color: #red; 
@link-color-hover: lightcoral; 
 
// And then they can be referenced like this: 
a, span. link { 
    color: @link-color; 
} 
 
a:hover, span.link:hover { 
    color: @link-color-hover; 
} 

As you might have noticed, double-slash style (//) inline comments are supported as well, while CSS only allows the slash-asterisk (/**/) syntax.

Get ASP.NET Core 2 and Angular 5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.