less - How to get value in percentage (%) or pixel (px) after doing some maths? | Lesscss -
i've little , simple question regarding lesscss. how can calculated value in percentage or pixel in lesscss. like, have : ((1 / 1) * 1) = 1
. know answer 1
, want "1"
in percentage or pixel this: "1%"
or "1px"
.
i need insert or put percentage (%)
or pixel (px)
sign in calculated value.
i'd appreciate help.
use:
unit(@yourvalue,px)
or
unit(@yourvalue,~"%")
additional note: default first occurring unit in calculation assigned result. example unit((1 / 2 * 3),px);
, (1px / 2% * 3rem)
both return 1.5px
.
Comments
Post a Comment