TigerSpirt
TigerSpirt

Reputation: 161

How save styles in less variables?

I have a doub in less (sorry am very novice). the next code can be posible? I mean, exist a way to do something like this?

@var01: {
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
}


.my_style {
  @var01;
  color: red;
}

I want save a class into a varible, and later use it. is posible? thanks!!!

Upvotes: 0

Views: 120

Answers (1)

Quentin
Quentin

Reputation: 943207

The feature you are looking for is mixins:

.foo {
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
}


.my_style {
  .foo();
  color: red;
}

Upvotes: 4

Related Questions