css – Sass是连接而不是添加?

参见英文答案 > Math with interpolated variables?1
我需要在我的SCSS代码中定义一个宽度:
#example {
  width: $currentWidth + 349 !important;
}

其中$currentWidth由循环定义.

然而,Sass总是最终连接两个数字,而不是进行算术.

我也试过:

width:#{$currentWidth 349} px!important;

这仍然导致连接.

我想知道我在做错什么?我知道这是非常基本的,但是我似乎还没有找到关于Sass如何处理算术的好信息

解决方法

假设$currentWidth是一个整数.

上海社会科学院:

$currentWidth: 30;

#example {
  width: unquote( ($currentWidth + 349) + 'px ' + !important );
}

CSS输出

#example {
  width: 379px !important;
}

你可以在这里测试:

http://sass-lang.com/try.html

相关文章

Css3如何实现鼠标移上变长特效?(图文+视频)
css3怎么实现鼠标悬停图片时缓慢变大效果?(图文+视频)
jquery如何实现点击网页回到顶部效果?(图文+视频)
css3边框阴影效果怎么做?(图文+视频)
css怎么实现圆角边框和圆形效果?(图文+视频教程)
Css3如何实现旋转移动动画特效