隐藏的CSS溢出有一个小故障,导致边框旁边出现空白



我这里有一个非常简单的代码,显示了一个小故障,在边界半径的角落里,有一点不应该有的空白。我只是在隐藏溢出的按钮后面有一个彩色div。在chrome中,当你放大和缩小时,你可以在隐藏溢出的整个边框中看到很多空白。[点击查看chrome屏幕截图]在萤火虫中,它更好,但角落里仍然有不应该有的空白。[点击查看firefox屏幕截图]我想不出任何解决办法,它很难看,请帮忙!thx

<style>
button {
border: 10px solid purple;
border-radius: 30px;
height:300px;
width:300px;
overflow: hidden;
position: relative;
}
div {
background: purple;
position: absolute;
height: 400px;
width: 400px;
}
</style>
<body>
<button><div></div></button>
</body>

您可以使用csslinear-gradient来解决此问题:

button {
border: 10px solid purple;
border-radius: 30px;
height: 300px;
width: 300px;
overflow: hidden;
position: relative;
background: linear-gradient(transparent 100px, purple 100px);
}
<button></button>

最新更新