Forum Moderators: not2easy
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled</title>
</head>
<body>
<style type="text/css">
#container{position:relative;height:100px;border:1px solid #000}
#container ul{list-style: none;padding: 0;margin: 0;position:absolute;top:0px;left:90px;width:100px;z-index:20;}
#container ul ul{display:none;}/* hide nested lists */
#container ul li{display:block;width:100px;background:red}
#container li.selected ul{display:block;} /* show nested list for item with selected class */
#container li.selected ul li{width:100px;position:absolute;top:0px;left:0px;background:yellow;z-index:10;}/* style nested item */
</style>
<div id="container"><div style="clear:both"></div>
<ul>
<li class="selected">item 1
<ul>
<li>Nested item 1</li>
</ul>
</li>
<li>item 2
<ul>
<li>Nested item 2</li>
</ul>
</li>
<li>item 3
<ul>
<li>Nested item 3</li>
</ul>
</li>
<div style="clear:both"></div>
</div>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled</title>
<style type="text/css">
#container {
position:relative;
height:100px;
border:1px solid #000;
}
#container ul {
list-style: none;
padding: 0;
margin: 0 0 0 90px; /* use margin rather than position to avoid z-indexing issues*/
width:100px;
background-color:red;
}
#container ul li {
width:100px;
}
#container ul li ul {
display:none;
}/* hide nested lists */
#container ul li.selected ul {
display:block;
width:100px;
background-color:yellow;
position:absolute;
top:0; /* is the top of the ul, which is also top of #container */
left:-90px; /* length of margin */
z-index:-1; /* Stack the sub-list behind the ul */
}
</style>
</head>
<body>
<div id="container">
<div style="clear:both"></div>
<ul>
<li class="selected">item 1
<ul> <li>Nested item 1</li> </ul>
</li>
<li>item 2
<ul> <li>Nested item 2</li> </ul>
</li>
<li>item 3
<ul> <li>Nested item 3</li> </ul>
</li>
</ul>
<div style="clear:both"></div>
</div>
</body>
</html>