其他分享
首页 > 其他分享> > stylus、scss的for和if写法对比

stylus、scss的for和if写法对比

作者:互联网

三种写法对比

 代码块:

// scss的写法
@for $i from 1 through 100 {
    @if $i%2 == 0 {
    .h-#{$i} { 
            height: #{$i}px; 
        }
  }
}
// stylus的写法
for num in (1..100) {
    if(num%2 == 0) {
        .h-{num} {
            height: num*1px
        }
    }
}
// stylus的写法  - 简写
for num in (1..100) 
    if num%2 == 0
        .h-{num} {
            height: num*1px
        }

 

标签:scss,height,stylus,num,100,写法
来源: https://www.cnblogs.com/stella1024/p/15703364.html