gpt4 book ai didi

css - Safari:background-clip 和 border-radius 不能很好地协同工作

转载 作者:太空宇宙 更新时间:2023-11-03 18:43:21 26 4
gpt4 key购买 nike

Fiddle

fiddle 中的 div.button 在 Chrome/FF 中看起来像预期的那样,但 background-clipborder-radius 不起作用在 Safari 中很好。

Div in different browsers

代码或 Safari 的行为方式有问题吗?

CSS

div.button {
width: 100px; height: 100px;
padding: 8px;

border-radius: 100px;
box-shadow: 0 0.8px 8px rgba(0,0,0,.3);
background-image: -webkit-radial-gradient(center center, circle, #8CE2FB, #52D2F8);
background-image: -moz-radial-gradient(center center, circle, #8CE2FB, #52D2F8);
background-image: -ms-radial-gradient(center center, circle, #8CE2FB, #52D2F8);
background-image: -o-radial-gradient(center center, circle, #8CE2FB, #52D2F8);
background-image: radial-gradient(center center, circle, #8CE2FB, #52D2F8);
-webkit-background-clip: content-box;
-moz-background-clip: content-box;
background-clip: content-box;
}

HTML

<div class="button"></div>

最佳答案

您可能需要为渐变指定特定的大小值。 http://dabblet.com/gist/5748608 (前缀没写,是js添加的)

div.button {
width: 100px; height: 100px;
padding: 8px;
border-radius: 100px;
box-shadow: 0 0.8px 8px rgba(0,0,0,.3);
background-image: radial-gradient(center, #8CE2FB 0, #52D2F8 52px, white 52px , white );/* oldest, includes your safari ? */
background-image: radial-gradient(circle at center, #8CE2FB 0, #52D2F8 52px, white 52px , white ); /* newest */
}
.bshad {/* box- shadow */
width: 100px; height: 100px;
padding: 8px;
border-radius: 100px;
box-shadow: 0 0.8px 8px rgba(0,0,0,.3), inset 0 0 1px 8px white, inset 0 0 0 200px #52D2F8 ;
}

虽然 Box-shadow 给出了更好的结果。

关于css - Safari:background-clip 和 border-radius 不能很好地协同工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17024013/

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