Hubbry Logo
search
logo
839500

Less (style sheet language)

logo
Community Hub0 Subscribers
Write something...
Be the first to start a discussion here.
Be the first to start a discussion here.
See all
Less (style sheet language)

Less (Leaner Style Sheets; sometimes stylized as LESS) is a dynamic preprocessor style sheet language that can be compiled into Cascading Style Sheets (CSS) and run on the client side or server side. Designed by Alexis Sellier, Less is influenced by Sass and has influenced the newer "SCSS" syntax of Sass, which adapted its CSS-like block formatting syntax. Less is an open source project. Its first version was written in Ruby; however, in the later versions, use of Ruby has been deprecated and replaced by JavaScript. The indented syntax of Less is a nested metalanguage, as valid CSS is valid Less code with the same semantics. Less provides the following mechanisms: variables, nesting, mixins, operators and functions; the main difference between Less and other CSS precompilers is that Less allows real-time compilation via less.js by the browser.

Less allows variables to be defined. Variables in Less are defined with an at sign (@). Variable assignment is done with a colon (:).

During translation, the values of the variables are inserted into the output CSS document.

The code above in Less would compile to the following CSS code.

Mixins allows embedding all the properties of a class into another class by including the class name as one of its property, thus behaving as a sort of constant or variable. They can also behave like functions, and take arguments. CSS does not support Mixins: Any repeated code must be repeated in each location. Mixins allows for more efficient and clean code repetitions, as well as easier alteration of code.

The above code in Less would compile to the following CSS code:

Less has a special type of ruleset called parametric mixins which can be mixed in like classes, but accepts parameters.

The above code in Less would compile to the following CSS code:

See all
User Avatar
No comments yet.