Is it possible to add text to the parameter supplied in Less?
@parameter:20
margin: @parameter + 'px';
The output would be
margin: 20px;
Is it possible to add text to the parameter supplied in Less?
@parameter:20
margin: @parameter + 'px';
The output would be
margin: 20px;
You can use variable interpolation:
@parameter: 20;
margin: ~"@{parameter}px";
Or in your case, unit
built-in function can also be used:
@parameter: 20;
margin: unit(@parameter, px);
Both will result in margin: 20px;
. (Working example)
margin: @parameter * 1px;
Works perfectly for me, I´m sure this was also somewhere on stack overflow before.
Edit, found it: Negate a numerical variable and add 'px' to it in LessCSS