118
Less default()
The Less default function is available only inside guard condition and returns true only if no other mixin matches otherwise, it returns false. It is interpreted as regular CSS when the default function is used outside the mixin guard condition.
Let’s take an example to demonstrate the usage of default function in the Less file.
Create a Less file named “simple.less”, having the following data.
Less file: simple.less
Now, execute the following code: lessc simple.less simple.css
This will compile the “simple.less” file. A CSS file named ?simple.css? will be generated.
For example:
The generated CSS “simple.css”, has the following code:
Output:
Next TopicLess Unit Function