sass功能强大,特别是支持for循环,节省大量开发时间,但是在开发时遇到一个问题,直接使用%时没有问题,当有变量时再加% 单位在编译时报错;

这样没有问题:

@for $width from 0 to 10{
.wp#{$width}{
width:$width px;
}
}

但是这样就有问题了:

@for $width from 0 to 10{
.wp#{$width}{
width:$width%;
}
}

或者这样:

@for $width from 0 to 10{
.wp#{$width}{
width:$width %;
}
}

编译时报错,试了好多方法还是不行,最后采用很二的方式竟然可以了:

@for $width from 0 to 10{
.wp#{$width}{
width:$width+0%;
}
}

Sass for循环中编译%时报错解决方案的更多相关文章

  1. tomcat启动窗口报错&&eclipse使用maven编译时报错

    tomcat启动窗口报错log4j:ERROR Could not find value for key log4j.appender.stdoutlog4j:ERROR Could not inst ...

  2. 使用Notepad++编码编译时报错(已解决?)

    使用Notepad++编码编译时报错(已解决?) 使用Notepad++编码,编译的时候经常会报错,说什么GBK编码啥啥啥~~~但同样的编码用ECLIPSE就没有问题.再有,用记事本把他保存成ANSI ...

  3. 配置python+mod_wsgi+apache 时 在浏览器中访问服务器时报错:Invalid HTTP_HOST header: 'XXXXX'. You may need to add u'XXXXX' to ALLOWED_HOSTS,在setting.py中添加‘*”无效的原因

    配置python+mod_wsgi+apache 时 在浏览器中访问服务器时报错:Invalid HTTP_HOST header: 'XXXXX'. You may need to add u'XX ...

  4. 对ESP8266的例子进行编译时报错check_python_dependencies的问题的解决

    尝试对ESP8266的例子进行编译时报错: make: *** 没有规则可制作目标"check_python_dependencies" 解决方法: 1.安装python pip包 ...

  5. VC中编译报错:error C2011: 'fd_set' : 'struct' type redefinition

    这是头文件包含顺序的问题,原因与解决办法见下面代码的注释. /* 包含下面这两个头文件时,必须把winsock2.h放在前面 否则编译报错,N多的重定义错误:例如 error C2011: 'fd_s ...

  6. 高版本 MySQL 导出的脚本到低版本 MySQL 中执行时报错

    导入 MySQL 脚本时报错:[ERR] 1273 - Unknown collation: 'utf8mb4_0900_ai_ci'低版本还不支持 utfmb4 这个字符集 解决方法:将 sql 脚 ...

  7. caffe中在某一层获得迭代次数的方法以及caffe编译时报错 error: 'to_string' is not a member of 'std'解决方法

    https://stackoverflow.com/questions/38369565/how-to-get-learning-rate-or-iteration-times-when-define ...

  8. Python3 编译中文字串报错解决方案

    问题: Python3.6.5 版本中,程序有中文,运行时出现以下error: SyntaxError: Non-UTF-8 code starting with '\xb2' in file XXX ...

  9. Qt - 错误总结 - 在自定义类头文件中添加Q_OBJECT 编译时报错(undefined reference to ‘vtable for xxThread)

    错误提示:在添加的QThread子类头文件添加Q_OBJECT时,编译程序,出现"undefined reference to 'vtable for xxThread'"错误提示 ...

随机推荐

  1. php后台开发(一)hello world

    php后台开发(一)hello world 环境安装 开发环境为Ubuntu 12.04,选择linux+apache+php的开发环境 安装 apache2 sudo apt-get install ...

  2. [ACM_几何] UVA 11300 Spreading the Wealth [分金币 左右给 最终相等 方程组 中位数]

    Problem A Communist regime is trying to redistribute wealth in a village. They have have decided to ...

  3. [J2ME] 获得MIDlet信息

    import javax.microedition.lcdui.Display; import javax.microedition.lcdui.Form; import javax.microedi ...

  4. eclipse中gradle的使用

    安装gradle gradle默认的本地缓存库在c盘user目录下的.gradle文件夹下,安装好gradle后,可以添加环境变量GRADLE_USER_HOME自定义缓存位置. 安装eclipse插 ...

  5. Why we need model on Django ?

    step01: create a database name as (django_db) on mysql ... step02: configure your django to use the ...

  6. java封装性

    原先是class Person{ public string name; public  int age } public void main{ Person person=new person(); ...

  7. 编写西游记人物类(XiYouJiRenWu)

    package java1; public class XiYouJiRenWu { double height; String name; String weapon; void printName ...

  8. 负margin在布局中的运用

    一.左右栏宽度固定,中间栏宽度自适应 <!DOCTYPE html> <html> <head lang="en"> <meta char ...

  9. vba中MsgBox的参数及用法

    1.作用    在消息框中显示信息,并等待用户单击按钮,可返回单击的按钮值(比如“确定”或者“取消”).通常用作显示变量值的一种方式.2.语法       MsgBox(Prompt[,Buttons ...

  10. (转)TRANSFORM_TEX详解

    原创文章如需转载请注明:转载自风宇冲Unity3D教程学院 特别讲:常见问题回答   本讲会陆续补充一些问题的解答. 问: (1) TRANSFORM_TEX是做什么的 (2)float4 _Main ...