Sergey Kudryashov
Sergey Kudryashov

Reputation: 723

LESS CSS Put style to THIS tag

I can't find a solution. For example I have a style in LESS:

.any{

  background: #fff;

  a{

    color: #faa;

  }
}
.any.last{
  background: #aaa;
}
.any.last a{
    color: #fa0;
}

I want to collect this styles into one brackets? In different languages it can be done using "$this". But here is no way. I want to do something like this:

.any{

  background: #fff;

  a{

    color: #faa;

  }

  this.last{
  background: #aaa;
  }
  this.last a{
    color: #fa0;
  }
}

Thnk you!

Upvotes: 0

Views: 228

Answers (1)

Evgeny Samsonov
Evgeny Samsonov

Reputation: 2750

Just use a &:

.any {
  background: #fff;

  a {
    color: #faa;
  }

  &.last {
    background: #aaa;
  }
  &.last a {
    color: #fa0;
  }
}

Upvotes: 5

Related Questions