sass在for循环中编译%报错 sass功能强大,特别是支持for循环,节省大量开发时间,但是在开发时遇到一个问题,直接使用%时没有问题,当有变量时再加% 单位在编译时报错; @for $i from 1 through 4 { .col-1 { width: 100/4 * $i + %;} } 这样会直接使用会报错 需要加0 @for $i from 1 through 4 { .col-#{$i} { width: 100/4 * $i + 0%; } }