How can I align all but one items in a navbar left, starting at the left margin and with a fixed combined minimum and maximum width, say 300px and 400px, but with the last item sent over to the right margin?
I need the result to look like this:
At the moment I've got four items and HTML and CSS as follows:
HTML
<div id="nav">
<ul>
<li><a href="/">One</a></li>
<li><a href="/">Two</a></li>
<li><a href="/">Three</a></li>
<li><a href="/">Four</a></li>
</ul>
</div>
CSS
#nav span {
display: inline-block;
position: relative;
}
#nav ul {
text-align: justify;
max-width: 400px;
}
#nav ul:after {
margin-left: 100%;
content: "";
}
#nav ul li {
display: inline;
}
Please note that I am justifying the elements within the 400px maximum width using the technique given in the accepted answer to this question. At the moment there are four elements within the 400px, but I need to take the fourth one out and send it over to the right.