gpt4 book ai didi

html - inset box-shadow 显示周围的边框,需要隐藏它

转载 作者:行者123 更新时间:2023-11-28 00:44:36 28 4
gpt4 key购买 nike

我用css创建了一个div让它变成圆形,我添加了内框阴影

.circle {
width: 690px;
height: 690px;
background: #000;
border-radius: 50%;
box-shadow: inset 0 0 80px 50px rgba(255, 255, 255, 1);
position: absolute;
left: -100px;
top: -100px;
}
<div class="circle"></div>

enter image description here

最佳答案

添加一个小填充并调整 background-clip :

.circle {
width: 690px;
height: 690px;
background: #000;
border-radius: 50%;
box-shadow: inset 0 0 80px 50px rgba(255, 255, 255, 1);
padding: 1px;
background-clip: content-box;
position: absolute;
left: -100px;
top: -100px;
}
<div class="circle"></div>

您还可以使用 radial-gradient 重新创建相同的内容:

.circle {
width: 690px;
height: 690px;
background: radial-gradient(#000 57%,transparent 70%);
border-radius: 50%;
position: absolute;
left: -100px;
top: -100px;
}
<div class="circle"></div>

关于html - inset box-shadow 显示周围的边框,需要隐藏它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51487394/

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