我想(临时)删除我的变量的单位@baseLineHeight和@baseFontSize,这样我可以把他们得到相对line-height.这就是我尝试过的:
@baseFontSize: 12px;
@baseLineHeight: 18px;
font: @baseFontSize~"/"@baseLineHeight/@baseFontSize sans-serif;
Run Code Online (Sandbox Code Playgroud)
生成以下错误:
Object #<Object> has no method 'toCSS' (Less::ParseError)
Run Code Online (Sandbox Code Playgroud)
首选输出:
font: 12px/1.5 sans-serif;
Run Code Online (Sandbox Code Playgroud)
同时似乎有一个功能:http: //lesscss.org/functions/#misc-functions-unit
这里是评论的代码,只是为了完整性.(感谢cfx).
font: @baseFontSize~"/"unit(@baseLineHeight/@baseFontSize) sans-serif;
Run Code Online (Sandbox Code Playgroud)