Вы также можете сделать простую окраску фона:
ul {
display: flex;
justify-content: space-between;
margin: 0;
padding: 0;
background:linear-gradient(#ccc,#ccc) center/100% 1px no-repeat;
}
li {
list-style-type: none;
background-color: white;
padding: 20px;
font-size:25px;
}
li:first-child {
padding-left: 0;
}
li:last-child {
padding-right: 0;
}
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
</ul>
И вот способ, которым вы можете иметь прозрачность:
ul {
display: flex;
justify-content: space-between;
margin: 0;
padding: 0;
background:
linear-gradient(blue,blue) left 50px top 50%,
linear-gradient(blue,blue) right 50px top 50%,
linear-gradient(blue,blue) center;
background-size:calc((100% - 4*50px)/3) 1px;
background-repeat:no-repeat;
}
li {
list-style-type: none;
width: 50px;
font-size:25px;
text-align:center;
}
body {
background:pink;
}
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
</ul>