通常我写分割线如下图
<div class="test">
<a *ngFor="let item of lists" href="">测试1</a>
</div>
.test {
a {
position: relative;
padding: 4px 20px;
& + a {
&::after {
position: absolute;
top: 20%;
left: 0;
content: "";
// 如下两种方式
height: 60%;
width: 1px;
background-color: red;
// width: 0px;
// border-left: 1px solid red;
}
}
}
}

解决方案如下
.test {
a {
position: relative;
padding: 4px 20px;
& + a {
&::after {
position: absolute;
top: 20%;
left: 0;
content: "";
height: 60%;
background-color: transparent;
width: 1px;
border-left: 1px solid red;
}
}
}
}
