(I'm quite new in web-design) I have a list of links (sections on current page) that can extend to multiple lines depending on viewport size. Links are separated by a vertical line (border-left):
I want to avoid the border to be displayed for first element of each line. I've managed to avoid it for the the first child but I can't figure out how to do it for the first element of each line. Something like:
Note that this list is probably different for each page.
Question: How to achieve such effect? CSS? JavaScript?
.links a {
display: inline-block;
}
.links a:not(:first-child) {
border-left: 1px solid black;
padding-left: 15px;
}
.links a:not(:last-child) {
padding-right: 15px;
}
<div class="links">
<a href="#">Link number 1</a>
<a href="#">Link number 2</a>
<a href="#">Link number 3</a>
<a href="#">Link number 4</a>
<a href="#">Link number 567</a>
<a href="#">Link number 6</a>
<a href="#">Link number 7</a>
<a href="#">Link number 8</a>
<a href="#">Link number 9</a>
</div>
PS: the display: inline-block
is just to avoid wrapping between lines. I'd like to avoid changing the HTML structure since many pages are affected. Such links are always nested in a <div class="links"></div>
as shown in the example.