gpt4 book ai didi

css - 使用 rgba 值时出现抗锯齿边界半径问题

转载 作者:行者123 更新时间:2023-11-28 08:49:34 25 4
gpt4 key购买 nike

我遇到一个问题,当我使用边界半径结合 rgba 值的颜色,比如让我们说 rgba(255,255,255,.8) 然后使用 box-shadow 使盒子看起来像羽毛一样,我得到的问题是 Angular 落不是实心的,如图中所示。

enter image description here

左上角细节: enter image description here

可以看出,当 border-radius 设置到位时,将 border radius 与其他 CSS 元素结合使用时,边缘会形成奇怪的透明边缘。

我已经尝试了很多但没有成功,这里是一个代码尝试,因为我想为另一个元素尝试这个但只是简单地复制它在这里:https://jsfiddle.net/01u7gbxa/1/

代码本身可以应用于任何对象,因此看起来解析为相同的结果:

  background:rgba(0,0,0,.8);
box-shadow:0 0 15px 30px rgba(0,0,0,.8);
border-radius:60px;

有人知道这是否有可能解决吗?

提前感谢您提供更多信息。

最佳答案

您可以使用模糊滤镜来做同样的事情。将其应用于伪元素以不影响任何潜在内容

body {
background: #f00;
display: flex;
justify-content: center;
align-items: center;
width: 100vw;
height: 100vh;
padding: 0;
margin: 0;
}

.box {
width: 500px;
height: 200px;
border-radius: 60px;
position: relative;
}

.box:before {
content: "";
position: absolute;
top: -10px;
left: -10px;
right: -10px;
bottom: -10px;
background: rgba(0, 0, 0, .8);
border-radius: inherit;
filter: blur(10px);
}
<div class="box"></div>

关于css - 使用 rgba 值时出现抗锯齿边界半径问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58282479/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com