A List Apart's Taming list - nested

Author: Mark Newhouse

Comments: This list is slightly modified from the Taming Lists model. Keep in mind that this list will render to the correct width in Win/IE5 and 6 if your doctype is in Quirks mode, but not if your doctype is set to Standards-Compliant mode. For more info on this, read Taming the Taming list model.

Browser support chart

HTML
<div id="navcontainer">
<ul id="navlist">
<li id="active"><a href="#" id="current">Item one</a>
<ul id="subnavlist">
<li id="subactive"><a href="#" id="subcurrent">Subitem one</a></li>
<li><a href="#">Subitem two</a></li>
<li><a href="#">Subitem three</a></li>
<li><a href="#">Subitem four</a></li>
</ul>

</li>
<li><a href="#">Item two</a></li>
<li><a href="#">Item three</a></li>
<li><a href="#">Item four</a></li>
</ul>
</div>

CSS
#navcontainer
{
margin-left: 30px;
width: 12em;
border-right: 1px solid #000;
padding: 0;
margin-bottom: 1em;
font-family: Verdana, Lucida, Geneva, Helvetica, Arial, sans-serif;
background-color: #90bade;
color: #333;
}

#navcontainer ul
{
list-style: none;
margin-left: 0;
padding: 0;
border: none;
}

#navcontainer li
{
border-bottom: 1px solid #90bade;
margin: 0;
}

#navcontainer li a
{
display: block;
padding: 5px 5px 5px 5px;
border-left: 10px solid #1958b7;
border-right: 10px solid #508fc4;
background-color: #2175bc;
color: #fff;
text-decoration: none;
width: 100%;
}

html>body #navcontainer li a { width: auto; }

#navcontainer li a:hover
{
border-left: 10px solid #1c64d1;
border-right: 10px solid #5ba3e0;
background-color: #2586d7;
color: #fff;
}

#navcontainer li li
{
border-top: 1px solid #90bade;
border-bottom: 0;
margin: 0;
}

#navcontainer li li a
{
display: block;
padding: 5px 5px 5px 20px;
border-left: 10px solid #1958b7;
border-right: 10px solid #508fc4;
background-color: #5ba3e0;
color: #fff;
text-decoration: none;
width: 100%;
}