Blocky gradient effect in CSS3

前端 未结 5 1559
后悔当初
后悔当初 2020-11-29 11:43

Is it possible to make the below gradient look more \"blocky\", so that instead of switching from green to red gradually, it\'s done in steps like the below picture?

5条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-29 12:23

    you can use box-shadow if you want certain color to show

    #gradients {
      width: 52px;
      display: block;
      height: 30px;
      background: #22b14c;
      box-shadow: #b5e61d 52px 0px 0px 0px, 
                  #fff200 104px 0px 0px 0px, 
                  #ffc90e 156px 0px 0px 0px, 
                  #ff7f27 208px 0px 0px 0px, 
                  #ed1c24 260px 0px 0px 0px;
    }

提交回复
热议问题