答案 0 :(得分:2)
使用:before
和:after
尝试使用,如下面的代码段所示。希望它有所帮助。
li {
list-style: none;
margin-bottom: 20px;
position: relative;
}
li::before {
background-color: red;
bottom: -5px;
content: "";
height: 20px;
left: -10px;
position: absolute;
width: 2px;
}
li::after {
background-color: red;
bottom: -5px;
content: "";
height: 2px;
left: -10px;
position: absolute;
width: 20px;
}
<ul>
<li>Hi</li>
<li>Hello</li>
<li>Welcome</li>
</ul>
更新:根据 JaTurna 对答案的评论,我们可以通过更改几行代码来实现。
li {
list-style: none;
margin-bottom: 20px;
position: relative;
}
li::before {
background-color: red;
bottom: 0;
content: "";
height: 20px;
left: -20px;
position: absolute;
width: 2px;
}
li::after {
border-bottom: 2px dashed red;
bottom: 10px;
content: "";
left: -20px;
position: absolute;
width: 15px;
}
<ul>
<li>Hi</li>
<li>Hello</li>
<li>Welcome</li>
</ul>