我的 CSS 和 HTML 文件中有以下代码:
.test {
width: 200px;
height: 200px;
border-radius: 50%;
box-shadow: inset 60px 0px white, inset 200px 0px blue;
}
<div class="test"></div>
这段代码生成的形状正是我想要的;但是,我不想要白色部分周围的蓝色轮廓 - 无论如何我可以删除它吗?
进一步说明:here是当前形状在白色背景上的样子,here是我希望它看起来的样子。
非常感谢所有帮助!
最佳答案
也许是个技巧,在其上叠加一个 2px 的白色边框是可以接受的。
.test {
width: 200px;
height: 200px;
border-radius: 50%;
box-shadow: inset 60px 0px 0px 0 white, inset 200px 0px 5px blue;
position:relative;
}
.test:before{
content:'';
position:absolute;
border-radius:50%;
border:2px solid white;
z-index:1;
top:-1px;
right:-1px;
bottom:-1px;
left:-1px;
pointer-events:none;
}
<div class="test"></div>
关于html - 围绕形状的 CSS 轮廓,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44479482/