I have a navigation bar with the following structure
nav {
text-align: center;
}
nav > ul {
list-style: none;
padding: 0;
margin: 8px auto;
}
nav > ul > li {
display: inline-block;
padding: 10px;
width: 200px;
text-align: center;
box-sizing: border-box;
border-right: 1px solid;
}
nav > ul > li:last-child {
border-right: 0px none;
}
nav a {
font-size: 130%;
}
<nav>
<ul>
<li><a href="url">link one</a>
<li><a href="secondurl">link two</a>
...
</ul>
</nav>
The li:last-child
block is useful to improve its look. But when the nav bar folds (like on a phone screen or a small browser window), I'd like to get rid of those borders before the line break. Is there a plain CSS way to do this? If not, how could I detect this in JavaScript?
I've looked at the MDN Selector list and it doesn't look like there is a pseudo-class selector that tailors to this need, and I imagine that a set of media queries for different breakpoints would allow me to calculate when to remove a given block's border, but this feels very hackish. Am I missing something closer to HTML that handles this issue?