我正在尝试以蛇的形式为几个相邻的块制作一个边框。如果角落是正确的,那么一切都会很简单。但是角必须是圆的。我试着这样做:
div {
width: 190px;
height: 200px;
border: 2px dashed gray;
border-top: none;
}
div:nth-of-type(1) {
border-right: none;
border-radius: 0 0 0 15px;
}
div:nth-of-type(2) {
border-left: none;
border-radius: 0 15px 15px 0;
margin-left: 10px;
}
div:nth-of-type(3) {
border-right: none;
border-radius: 15px 0 0 15px;
}
div:nth-of-type(4) {
border-left: none;
border-radius: 0 15px 15px 0;
margin-left: 10px;
}
<div></div>
<div></div>
<div></div>
<div></div>
但是在某些角落,接缝清晰可见:(有什么办法可以解决这个问题吗?或者这个问题可能有另一种解决方案?
UPD:
overflow:hidden;来救援事实证明,不透明的背景不适合问题的条件。然后我们将每个块包装在另一个块中,并为包装器提供属性
overflow:hidden;。负的上边距会将顶部边框推出包装器,而包装器会将其隐藏。白色背景做脏活
background-clip为border-box,背景在边框下爬行。)