Skip to main content

Nesting Classes

Nesting Classes

 

Less gives you the ability to use nesting instead of, or in combination with cascading. Let's say we have the following CSS:

#header{
     color: black;
}
#header .navigation{
     font-size: 12px;
}
#header .logo{
     width: 300px;
}

In Less, we can also write it this way:

#header{
     color: black;
     .navigation{
          font-size: 12px;
      }
     .logo{
          width: 300px;
     }
}

The resulting code is more concise, and mimics the structure of your HTML.

See more at http://lesscss.org/features/#features-overview-feature