To create a stylish design, utilize the pseudo element ::before
positioned absolutely inside a relatively positioned LI element. Experiment with borders and radius:
.list {
line-height: 1rem;
list-style: none;
padding: 0;
>li {
position: relative;
align-items: center;
padding: 0.6rem 1rem;
border-left: 1px solid #000;
&::before {
position: absolute;
left: 0;
top: 50%;
content: "";
width: 0.6rem;
border: solid #000;
border-width: 1px 0 0 0;
}
&:first-child {
font-weight: bold;
border-left: 0;
&::before {
height: calc(100% - 1.1rem);
top: 1.1rem;
border-radius: 10px 0 0 0;
border-width: 1px 0 0 1px;
}
}
&:last-child {
border-left: 0;
&::before {
height: calc(100% - 1.1rem);
top: 0rem;
border-radius: 0 0 0px 10px;
border-width: 0 0px 1px 1px;
}
}
}
}
<div class="list">
<li>Lorem<br>new-line test</li>
<li>Ipsum</li>
</div>
<div class="list">
<li>Lorem</li>
<li>Ipsum</li>
<li>Dolor</li>
</div>
<div class="list">
<li>Lorem</li>
<li>Ipsum</li>
<li>Dolor</li>
<li>Sit</li>
<li>Amet</li>
</div>
You can also implement Unicode's Box drawing lines as an alternative option:
.menu {
line-height: 1rem;
list-style: none;
>li {
&::before {
margin-right: 0.5rem;
content: "\2520";
}
&:first-child::before {
content: "\256d";
}
&:last-child::before {
content: "\2570";
}
}
}
<div class="menu">
<li>Lorem</li>
<li>Ipsum</li>
<li>Dolor</li>
<li>Sit</li>
<li>Amet</li>
</div>
Keep in mind that when using Unicode's Box drawing lines, line wraps or spacing that exceeds line-height of 1
may not be possible.