如果我有行高的数值LESS变量
@lineHeight: 1.2
Run Code Online (Sandbox Code Playgroud)
如何将em添加到其末尾以设置要生成的元素的高度:
height: 1.2em;
Run Code Online (Sandbox Code Playgroud)
以下不起作用:
height: @(lineHeight)em;
height: @(lineHeight)"em";
height: @(lineHeight) + "em";
height: @lineHeight + "em";
Run Code Online (Sandbox Code Playgroud)
我已经看到其他线程,答案是添加一个单位并不容易,但这似乎并不正确,因为数字线高值与em单位齐头并进.
我在商店主题混合中找到了解决方案
height: ~"@{lineHeight}px";
Run Code Online (Sandbox Code Playgroud)
但您评论中的解决方案seven-phases-max也有效
height: unit(@lineHeight, px);
Run Code Online (Sandbox Code Playgroud)