use Less to reduce CSS clutter!

Sign in to queue


Reading a post by Phil Haack, I learned about a neat technology called LESS that helps reduce the amount of CSS and duplicated code you have to create.  It was originally a Ruby Gem but now has a .Net port called .Less which can be found at

It lets you do some amazing things like global changes and even operations!


@brand_color: #4D926F;
#header {
  color: @brand_color;
h2 {
  color: @brand_color;


@the-border: 1px;
@base-color: #111;
#header {
  color: @base-color * 3;
  border-left: @the-border;
  border-right: @the-border * 2;
#footer { 
  color: (@base-color + #111) * 1.5; 


ASP.NET, CSS, Web, C4FNews

The Discussion

  • User profile image

    This is something the W3C should have added to the CSS spec years ago. At least the ability to define a colour at the top of your CSS file, and then use it again later on. That would make life much easier.

    Truth is, it's pretty easy to get ASP.NET to handle your CSS files and do this yourself. You can do some basic parsing of the CSS file and emit valid CSS based on your settings.

    Thanks for the info.

  • User profile image

    Their site was moved to

    I also think it was quite sane to keep CSS lean and occasionally use tools like this.

Add Your 2 Cents