Forum Moderators: not2easy
I need to use semantically correct mark up for a 5 sub level nested list which needs to appear visually as a horizontal navigation on the web page.
the mark up on the page is something like this:
<ul class="nav">
<li class="noTop"><a href="#">Home</a>
<ul class="nav1">
<li><a href="#">Bedroom</a></li>
<li><a href="#">Kitchen</a>
<ul class="nav2">
<li><a href="#">Cooker</a></li>
<li><a href="#">Fridge</a>
<ul class="nav3">
<li><a href="#">Tomatoes</a></li>
<li><a href="#">Carrots</a>
<ul class="nav4">
<li><a href="#">Red</a></li>
<li><a href="#">Crunchy</a></li>
<li><a href="#">Green Stalk</a></li>
<li><a href="#">Dirt</a></li>
<li><a href="#">Juce</a></li>
</ul>
</li>
<li><a href="#">Milk</a></li>
<li><a href="#">Eggs</a></li>
<li><a href="#">Cheese</a></li>
<li><a href="#">Meat</a></li>
</ul>
</li>
<li><a href="#">Sink</a></li>
<li><a href="#">Microwave</a></li>
<li><a href="#">Cupboards</a></li>
<li><a href="#">Pantry</a></li>
</ul>
</li>
<li><a href="#">Garage</a></li>
<li><a href="#">Closet</a></li>
<li><a href="#">Cellar</a></li>
<li><a href="#">Loft</a></li>
</ul>
</li>
<li class="left"><a href="#">Services</a></li>
<li><a href="#">Garden</a></li>
<li><a href="#">Outhouse</a></li>
<li><a href="#">Pool</a></li>
<li><a href="#">Shrubs</a></li>
</ul>
</div>
In the CSS:
ul {
list-style: none;
}
#navWrap {
width: 100%;
}
ul li {
display: inline;
}
ul.nav,
ul.nav li ul li ul.nav2,
ul.nav li ul li ul li ul li ul.nav4 {
list-style: none;
float: left;
display: block;
width: 100%;
background: #666;
}
ul.nav li a,
ul.nav li ul li ul.nav2 li a,
ul.nav li ul li ul li ul li ul.nav4 li a {
list-style: none;
float: left;
display: block;
padding: .5em 1em;
background: #666;
color: #fff;
}
ul.nav li ul.nav1,
ul.nav li ul li ul li ul.nav3 {
list-style: none;
float: right;
display: block;
width: 100%;
background: #06c;
}
ul.nav1 li a,
ul.nav li ul li ul li ul.nav3 li a {
list-style: none;
float: right;
display: block;
padding: .5em 1em;
background: #06c;
font-weight: bold;
color: #fff;
}
The way I thought to tackle it is to use negative margins on the top to pull each item up into place. If I use positioning then everything is taken out of the flow of the document and scaling the layout (elastic 'em') layout up will mean the items that come after this navigation will not be pushed down...
any super intelligence would be REALLY welcome..
ZA
Why re-invent the wheel? ;-)