AboutBlogContact
Frontend EngineeringMay 20, 2010 2 min read 105Updated: June 22, 2026

LESS: DRY Stylesheets with Mixins and Variables (2010)

AunimedaAunimeda
📋 Table of Contents

LESS: DRY Stylesheets with Mixins and Variables

It’s 2010, and we’re all tired of copy-pasting hex codes and repeating the same vendor prefixes across our CSS files. If you're building a "Web 2.0" site with gradients and rounded corners, your CSS is probably a nightmare to maintain.

LESS is here to save us. It extends CSS with dynamic behavior.

Variables

Stop searching and replacing hex codes. Define them once.

@primary-color: #4D926F;
@border-radius: 5px;

header {
  color: @primary-color;
}

.button {
  background-color: @primary-color;
  border-radius: @border-radius;
}

Mixins

Mixins allow you to embed all the properties of a class into another class. This is perfect for those repetitive CSS3 properties.

.rounded-corners(@radius: 5px) {
  -webkit-border-radius: @radius;
  -moz-border-radius: @radius;
  border-radius: @radius;
}

#header {
  .rounded-corners;
}

#footer {
  .rounded-corners(10px);
}

Nesting

Instead of writing long selectors, you can nest them. It matches your HTML structure and makes the code much cleaner.

#header {
  h1 {
    font-size: 26px;
    font-weight: bold;
  }
  p {
    font-size: 12px;
    a {
      text-decoration: none;
      &:hover { border-width: 1px }
    }
  }
}

In 2010, LESS is the leading tool for anyone who wants to write CSS like a programmer. It’s making the web look better, one variable at a time.


Aunimeda builds modern web frontends - from single-page applications to complex multi-locale sites.

Contact us to discuss your frontend project. See also: Web Development, Corporate Website Development

Read Also

Zero-Runtime CSS-in-JS: The Performance King (2023)aunimeda
Frontend Engineering

Zero-Runtime CSS-in-JS: The Performance King (2023)

Is Styled Components dead? In 2023, zero-runtime CSS-in-JS is taking over. No more runtime script, no more style re-calculation.

Tailwind CSS JIT: Transforming Build Times and Workflow (2020)aunimeda
Frontend Engineering

Tailwind CSS JIT: Transforming Build Times and Workflow (2020)

The JIT engine is the biggest shift in Tailwind's history. No more 10MB development CSS files-just pure speed and on-demand generation.

The 2004 Optimization: Reducing HTTP Requests with CSS Spritesaunimeda
Frontend Engineering

The 2004 Optimization: Reducing HTTP Requests with CSS Sprites

In the era of dial-up and early DSL, every HTTP request counts. If you're loading 20 icons individually, you're killing your site's performance. It's time to learn the CSS Sprite technique.

Need IT development for your business?

We build websites, mobile apps and AI solutions. Free consultation.

Web Development

Get Consultation All articles