Weird gradient border effect

前端 未结 7 534
旧时难觅i
旧时难觅i 2020-11-30 05:33

When applying a transparent border over an element with a linear-gradient as the background, I get a weird effect.

7条回答
  •  执念已碎
    2020-11-30 05:53

    Other answers have already shown how to fix the issue, but I thought I should just point out that if you increase the border-width it becomes apparent that the background is actually repeating.

    .colors {
        width: 100px;
        border: 100px solid rgba(0,0,0,0.2);
        height: 50px;
        background: linear-gradient(to right, 
            #78C5D6,
            #459BA8,
            #79C267,
            #C5D647,
            #F5D63D,
            #F08B33,
            #E868A2,
            #BE61A5);
    }
    

    will produce

    enter image description here

提交回复
热议问题