Reputation: 123
Is there a way to use property names as variables in LESS?
For example:
h1 {
font-size: 16px;
line-height: font-size * 2;
}
The above snippet doesn't work, and I wonder how to get this effect?
Upvotes: 1
Views: 89
Reputation: 2633
I don't think it's possible.
A workaround is creating a variable and assign the font-size to it. Then you can use this to multiply the value:
@fontsize: 16px;
h1 {
font-size: @fontsize;
line-height: @fontsize * 2;
}
Upvotes: 2