compass把font中/当成了除号?



 $font-size:12px;
$line-height:1.5;

*{
   font:$font-size/$line-height "Microsoft Yahei",arial,"宋体";
}

css文件解析为:
*{
font: 8px "Microsoft Yahei", arial, "宋体";
}

sass compass web前端开发

Surufel 9 years, 8 months ago

建议您还是分开写吧。哈哈
或者使用非转义符合"\"

我不是陈冠希 answered 9 years, 8 months ago

Sass 中符号 "/" 被重载为除法运算符,要想让"/"表示 CSS 中的分隔符,可以使用插值,即用 #{variable}:


 $font-size:12px;
$line-height:1.5;

*{
   font: #{$font-size}/#{$line-height} "Microsoft Yahei",arial,"宋体";
}

compiled to:


 * {
  font: 12px/1.5 "Microsoft Yahei", arial, "宋体";
}

淡意D优柔╮ answered 9 years, 8 months ago

Your Answer