I have a list of elements that I would like to connect via a bordering line. This line should be limited to each parent but should touch all children of the parent (for each parent in the list). My problem as you can see from a screenshot is that my line goes through the entire page top to bottom and doesn't seem to conform to the height of the parent nor cut off when each child list stops.
Ideally, there would be two separate lines in this picture with one between test1 and test2 and another that goes from test2 to the end of the whole list (with some buffer room between parent and line so they aren't touching).
Any thoughts? I have tried for hours to add different styles to try and limit the lines height but nothing has worked. Thank you!
#test ul li ul li::before {
content: "";
display: block;
position: absolute;
z-index: 1;
left: 50px;
top: 0;
bottom: 0;
max-height: 100%;
border-left: 1px solid #7A7A7A;
}
<div id="test">
<ul>
<li>
test1
<ul>
<li>
1
</li>
<li>
2
</li>
<li>
3
</li>
<li>
4
</li>
</ul>
</li>
<li>
test2
<ul>
<li>
1
</li>
<li>
2
</li>
<li>
3
</li>
<li>
4
</li>
</ul>
</li>
</ul>
</div>