use*_*810 2 html css box-shadow
我用 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;
}Run Code Online (Sandbox Code Playgroud)
<div class="circle"></div>Run Code Online (Sandbox Code Playgroud)
添加一个小填充并调整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;
}Run Code Online (Sandbox Code Playgroud)
<div class="circle"></div>Run Code Online (Sandbox Code Playgroud)
您还可以使用以下命令重新创建相同的内容radial-gradient:
.circle {
width: 690px;
height: 690px;
background: radial-gradient(#000 57%,transparent 70%);
border-radius: 50%;
position: absolute;
left: -100px;
top: -100px;
}Run Code Online (Sandbox Code Playgroud)
<div class="circle"></div>Run Code Online (Sandbox Code Playgroud)