简体   繁体   English

奇怪的黑色边框在 CSS

[英]Weird Black Border in CSS

I've created a box with a fade-background.我创建了一个带有淡入淡出背景的框。 Because of this, I get a weird black border on the right side and I don't know how to fix this.因此,我在右侧出现了一个奇怪的黑色边框,我不知道如何解决这个问题。 (The missing left border's on purpose.) (缺失的左边框是故意的。)

#fadebox
{
    width: 300px;
    background-image: linear-gradient(to right, rgba(0,0,0,0.7), rgba(0, 0, 0, 0));
    border-width: 3px;
    border-style: solid;
    border-image: linear-gradient(to right, #055100, rgba(0, 0, 0, 0)) 1 0 1 0 round;
}

Weird_Black_Border_Image.png Weird_Black_Border_Image.png

One naive implementation is just by specifying border-right: 0;一种简单的实现方式是指定 border-right: 0; So if you want just a solution and not why exactly it happened go ahead and use the following:因此,如果您只想要一个解决方案,而不是为什么它会提前发生 go 并使用以下内容:

#fadebox
{
    width: 300px;
    background-image: linear-gradient(to right, rgba(0,0,0,0.7), rgba(0, 0, 0, 0));
    border-width: 3px;
    border-style: solid;
    border-image: linear-gradient(to right, #055100, rgba(0, 0, 0, 0)) 1 0 1 0 round;
    border-right: 0;
}

It's most likely happening because of to right background-image and border-image combining together but border-right: 0 should solve it.这很可能是因为 right background-image 和 border-image 结合在一起而发生的,但 border-right: 0 应该可以解决它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM