其实就是“展开”有边框,填充色和背景颜色一样(白色),然后再遮挡不需要的线条
<div class="wrap">
<div class="container">
<span>展开span>
div>
div>
.wrap{
width: 600px;
height: 1px;
background-color: #e8e8e8;
position: absolute;
top: 100px;
}
.container{
width: 80px;
height: 36px;
line-height: 30px;
text-align: center;
color: #000000a6;
background-color: #fff;
border: 1px solid #e8e8e8;
border-top: none;
border-radius: 5px;
margin: 0 auto;
transform: translateY(-50%);
position: relative;
}
.container::before,.container::after{
content: "";
width: 2px;
height: 18px;
background-color: #fff;
position: absolute;
top: 0;
}
.container::before {
left: -1px;
}
.container::after {
right: -1px;
}
后期可以增加展开箭头,和更改“展开”“收起”的文字描述。这里是展示css样式