2

I have .aClass

.aClass {
 width: 20px;
 height: 20px;
}

In .anotherClass I would like to calculate a width value based on the value of the width attribute in .aClass.

.anotherClass {
 width: .aClass.width
}

The above example does not work.

I couldn´t find anything in the less docs. Is there any way to do this?

Harry
  • 87,580
  • 25
  • 202
  • 214
Björn
  • 12,587
  • 12
  • 51
  • 70

1 Answers1

1

Declare variable at the top of code

@width: 10px

Then,

.aClass {
 width: @width;
 height: 20px;
}

.anotherClass {
 width: @width;
}
Chandrakant
  • 1,971
  • 1
  • 14
  • 33