How can I prevent CSS gradient banding?

后端 未结 7 1784
别那么骄傲
别那么骄傲 2020-12-05 06:20

I started using CSS gradients, rather than actual images, for two reasons: first, the CSS gradient definitely loads faster than an image, and second, they aren\'t supposed t

7条回答
  •  甜味超标
    2020-12-05 07:10

    I know this issue is long solved, but for others experiencing banding and looking for a solution, a very easy fix for me was just simplifying the colours I included in my gradient. For example:

    This gradient produces banding:

    background-image: linear-gradient(-155deg, #202020 0%, #1D1D1D 20%,
    #1A1A1A 40%, #171717 60%, #141414 80%, #101010 100%);
    

    This gradient does not, and looks much the same:

    background-image: linear-gradient(-155deg, #202020 0%, #101010 100%);
    

提交回复
热议问题