less Getting started with less Nesting in Less


Example

In Less you can write much more simple CSS rules and also keep them well formatted, so instead of writing this code:

CSS

.item {
  border: 1px solid;
  padding: 4px;
}
.item .content, .item .image {
  float: left;
}
.item .content {
  font-size: 12px;
}
.item .image {
  width: 300px;
}

you can just write this:

Less

.item {
  border: 1px solid;
  padding: 4px;
  .content, .image {
    float: left;
  }
  .content {
    font-size: 12px;
  }
  .image {
    width: 300px;
  }
}

and Less will compile that code into the normal CSS we all know.