您可以使用徑向漸變在CSS
刪除邊框並使用這一行:前
background:radial-gradient(white 20% , rgb(6, 42, 64) 21% , rgb(6, 42, 64) 47% , white 48%);
檢查也是下面的例子,容器不用於除了具有不同背景之外的任何東西都應用於:之前
HTML
<div class="container"></div>
CSS
.container
{
display:inline-block;
width:100px;
height:200px;
position:relative;
background-color:#062a40;
}
.container:before
{
content:" ";
width:50px;
height:50px;
position:absolute;
top:50%;
left:50%;
transform:translate3d(-50%,-50%,0);
border-radius:50%;
background: -webkit-radial-gradient(white 20% , rgb(6, 42, 64) 21% , rgb(6, 42, 64) 47% , white 48%);
background: -o-radial-gradient(white 20% , rgb(6, 42, 64) 21% , rgb(6, 42, 64) 47% , white 48%);
background: -moz-radial-gradient(white 20% , rgb(6, 42, 64) 21% , rgb(6, 42, 64) 47% , white 48%);
background: radial-gradient(white 20% , rgb(6, 42, 64) 21% , rgb(6, 42, 64) 47% , white 48%);
}
您可以通過更改徑向漸變顏色的百分比定製它,也不要忘了添加瀏覽器的前綴