Below is the logic for the simple menu. The issue is when the text breaks into two lines extra white space is added to the <a>
element
white-space: nowrap
can remove white space, but will prevent the text from breaking, when the viewport width is not wide enough to naturally fit the text in one line. It's also not desired to set fixed-width on each child.
.menu {
display: flex;
width: 100%;
}
.menuItem {
list-style: none;
padding-right: 50px;
display: inline-flex;
}
.menuItem a {
display: inline;
background-color: #ccc;
}
.menuItem span {
width: 12px;
height: 4px;
background-color: green;
display: inline-block;
margin-left: 10px;
}
<ul class='menu'>
<li class='menuItem'>
<a target='_' href='https://www.google.com'>Two Words</a>
<span></span>
</li>
<li class='menuItem'>
<a target='_' href='https://www.google.com'>
Two Words</a>
<span></span>
</li>
<li class='menuItem'>
<a target='_' href='https://www.google.com'>
Two Words</a>
<span></span>
</li>
<li class='menuItem'>
<a target='_' href='https://www.google.com'>
Two Words</a>
<span></span>
</li>
<li class='menuItem'>
<a target='_' href='https://www.google.com'>Two Words</a>
<span></span>
</li>
</ul>