Description #
Less (Leaner Style Sheets) is a dynamic preprocessor style language that extends CSS with variables, mixins, functions, and nested rules, allowing more maintainable and scalable stylesheets.
History #
Less was created by Alexis Sellier in 2009 to bring programming-like features to CSS. Initially written in Ruby, it was later rewritten in JavaScript and is now widely used in front-end development workflows. It integrates easily with Node.js environments and has become a popular choice for styling dynamic web applications.
Hello World Code #
@text-color: #333;
body {
color: @text-color;
}
How to Run #
Option 1: Online
- Less Compiler – BeautifyTools
- CodePen (Use as Preprocessor)
- JSFiddle – Select LESS from CSS dropdown
Option 2: Local
Install Node.js and Less:
npm install -g less
Compile:
lessc styles.less styles.css
Key Concepts #
- Variables for reusable values
- Nested rules for hierarchy
- Mixins to reuse groups of styles
- Functions and operations
- Easy maintenance of large CSS files
- Compiles into standard CSS
- JavaScript-based and Node-friendly
- Cross-browser compatible
- Conditional logic support
- Supports plugin extensions
Try It Online #
- Less Compiler
- CodePen – Set LESS as preprocessor
- JSFiddle – Use LESS in settings
Fun Facts #
- The name “Less” is a play on “CSS” — giving more functionality with less code.
- Bootstrap originally used Less before switching to Sass.
- Less allows calculations like
width: (100% / 3);
in styles.