[SCSS] Create a gradient with a Sass loop

In this lesson, you will learn how to iteratively generate CSS selectors and attributes using Sass loops. We will create a gradient of 100 elements, each with 1% darker colour using only a couple of lines of Sass.

 

@for $i from 1 through 100 {
  .block#{$i} {
    background: darken(white, $i);
  }
}

 

posted @ 2019-01-03 02:46  Zhentiw  阅读(153)  评论(0编辑  收藏  举报