Trouble outputting font property using less variables

*爱你&永不变心* 提交于 2020-01-06 08:25:09

问题


I'm using twitter bootstrap with less and I have the following:

@serifFontFamily: 'Droid Serif', "Georgia", Times, serif;
@baseFontSize: 100%/1.5;

font: @baseFontSize @serfiFontFamily;

it produces:

font: 66.666666667% 'Droid Serif', "Georgia", Times, serif

but I want to output this:

font: 100%/1.5 'Droid Serif', "Georgia", Times, serif

Any tips?


回答1:


You can use

@baseFontSize: ~"100%/1.5";

and less will interpret it as a string and not as an expression.




回答2:


I had decomposed the property font in 3 properties:

font-size: @baseFontSize;
font-family: @baseFontFamily;
line-height: @baseLineHeight;

and my variables:

@baseFontSize:          100%;
@baseFontFamily:        'Droid Serif', "Georgia", Times, serif;
@baseLineHeight:        1.5;

than it works properly!



来源:https://stackoverflow.com/questions/13159576/trouble-outputting-font-property-using-less-variables

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!