I've got some menu items that will be translated, and in some languages the text will have to wrap to accommodate the longer text.
The menu is a flexbox row of UL>LI elements with A tags in them.
<ul>
<li>
<a href="#">
Ce que nous faisons
</a>
</li>
<li>
<a href="#">
Logiciels que nous supportons
</a>
</li>
<li>
<a href="#">
les industries
</a>
</li>
<li>
<a href="#">
Entreprise
</a>
</li>
</ul>
When text is not wrapping, each menu item has an equal space between them and the menu feels balanced and readable. However once the text within an A tag starts to wrap, some extra whitespace seems to be preserved by the browser, creating large and uneven gaps between menu elements that does not look correct.
This would be my desired result:
I created this result by manually setting widths in pixels for the first two items. Not practical for my use case but it illustrates what I am hoping to achieve dynamically. When items wrap, there is no extra whitespace preserved in their containers, and the space between menu items is even.
The only CSS I've been able to find that effects this extra whitespace is adding width: min-content;
to my A tags. However this goes too far in the other direction, breaking at every space and producing something like this:
Some have suggested using a combination of width: min-content; + non-breaking spaces to achieve the desired result. However there are too many languages, menu items, and potential responsive break points to make this a practical solution.