CSS Gradient - too many color breaks

后端 未结 1 625
清酒与你
清酒与你 2020-12-19 18:54

I am running into an issue with css linear-gradients. I am looking to make clean color breaks at certain percentages. But it seems to start blurring the colors when I add mo

相关标签:
1条回答
  • 2020-12-19 19:27

    In such case it's better to use multiple gradient:

    div {
      height: 100px;
      background: 
        /* Color                       position /width height   */
        linear-gradient(#03aeef,#03aeef)  50% 0 / 5%  100%, /* top layer */
        linear-gradient(#fff,#fff)        50% 0 / 10% 100%,
        linear-gradient(#03aeef,#03aeef)  87% 0 / 5%  100%,
        linear-gradient(#ffd900 ,#ffd900) 94% 0 / 5%  100%,
        linear-gradient(#fff,#fff)        95% 0 / 15% 100%,
        linear-gradient(#042750,#042750)  right / 60% 100%; /* bottom layer */
      background-repeat:no-repeat;
    }
    <div></div>

    0 讨论(0)
提交回复
热议问题