I know that this must be one of most asked questions, but I really want to understand - why justified grid menu must have a space between <li>
elemtents?
I made an example here: http://jsbin.com/oNibesA/1/edit
CSS:
.inline-list {
text-align: justify;
list-style: none;
margin: 0;
padding: 0;
}
.inline-list:after {
content: "";
display: inline-block;
width: 100%;
}
.inline-list li {
display: inline-block;
margin: 0;
padding: 0;
}
.inline-list li:before {
content: ' ';
}
.inline-list li a {
display: block;
padding: 5px 10px;
}
This HTML (with spaces) works fine - it spreads the elements evenly in one line:
<ul class="inline-list">
<li><a>Everything</a></li>
<li><a>Is</a></li>
<li><a>Fine</a></li>
<li><a>With</a></li>
<li><a>Multiline</a></li>
<li><a>HTML</a></li>
</ul>
But this HTML (all in one line without spaces) doesn't spread evenly:
<ul class="inline-list"><li><a>This</a></li><li><a>Is</a></li><li><a>A</a></li><li><a>Weird</a></li><li><a>CSS/HTML</a></li><li><a>Bug</a></li></ul>
Now I know that it happens, but I'm curious - why it happens?
And can you somehow fix this (for example, put the space between the <li>
elements) just by using CSS?