The menu on this website is not justified as intended.
This may be a repost, although I have read all previous solutions for this issue… it is breaking my brain right now.
I am currently using this CSS technique for justifying the elements of a menu :
<ul class="justified"><li>Element</li></ul>
Explanation is given on CSS Tricks (last technique) :
https://css-tricks.com/equidistant-objects-with-css/
I have been using this solution on different websites and I now encounter this issue after a WordPress update. (First time I get a problem on a theme after an upgrade).
Thanks for the help,
UPDATE #1
As of Pangloss answer, WordPress is generating <li>
elements without separating them with a whitespace. This is a strange behaviour… I fixed the problem by manually adding the missing whitespace.
$menu = wp_nav_menu($defaults);
$menu = str_replace("</li><li", "</li> <li", $menu);
The
text-align:justify
positioning trick requires to have white space (blank space) between the child items in the markup.In the following example, it works, because there are white spaces between the
<li>
tags.However, it doesn’t work in the following example, because there is no white space in between them, although the CSS is exactly the same as above. It’s the same issue with your WordPress generated code.
But, there are other ways, such as using Modern CSS3 flexbox.