SCSS mixin在转换时的持续时间前加零

时间:2014-09-09 12:02:08

标签: sass

我有一个Sass mixin用于我的所有过渡效果:

$transition-time: .2s;
$transition-method: ease-in-out;

@mixin transition($transition-property){
    -webkit-transition: $transition-method $transition-property $transition-time !important;
    -moz-transition: $transition-method $transition-property $transition-time !important;
    -ms-transition: $transition-method $transition-property $transition-time !important;
    -o-transition: $transition-method $transition-property $transition-time !important;
    transition: $transition-method $transition-property $transition-time !important;
}

如果你注意到我的$transition-time: .2s;被宣布为.2s。问题是Sass在编译时在前面0.2s添加了一个零。我从没想过这会是一个问题,但它让我的几个过渡不起作用。我试图将.2s放在mixin中,但在编译时它仍会添加零。其他人都有这个问题并知道如何解决它?

0 个答案:

没有答案