I am looking to make a two-column navigation bar by using a single <ul>
with six <li>
items:
<nav>
<ul>
<li>Home</li>
<li>About</li>
<li>Team</li>
<li>Store</li>
<li>Blog</li>
<li>Contact</li>
</ul>
</nav>
Three elements on one side, and three on the other; ordered vertically.
Right now, it's easy to do when making two seperate <ul>
elements and putting padding/margins between them: http://jsfiddle.net/Baumr/SJcjN/ — but that's not a great solution.
Could also wrap <span>
tags around each set of three <li>
's — but is that the only CSS solution?
Looking for some elegant ideas. Thank you!
I think that using
<span>
's might be the most cross-browser friendly solution.Unless someone has other ideas? Looking for something cross-browser compatible, as sadly IE doesn't support
nth-child(N)
.This is not as clean (HTML wise) as I wanted, with these random spans, but here is the HTML:
(Notice the
span
inside theul
— big faux pas in my book.)And the CSS:
But that's hardly a good solution... any other ideas?
CSS:
They will order like that:
If that's not a problem, you have a very simple solution.
EDIT:
This will order them in the correct way. not sure how IE will act, but will work in all other browsers.
or you can follow strictly the
UL-LI
concept, so your html will look like this an you can have as many column as you need:Making a correct and well formated html can make your life easier.