I have a menu and a submenu. The submenu needs to display on mouseover, but needs to display below the colored area. When I mouseout of Item 3, the submenu disappears.
I understand why it is disappearing and I am wondering if there is a way make this work. Margin and Padding didn't seem to work on the ul li css.
<div id="bg">
<ul class="menu">
<li class="first leaf">Item 1</li>
<li class="leaf">Item 2</li>
<li class="expanded">Item 3
<ul class="menu">
<li class="leaf">Sub-item 1</li>
<li class="leaf">Sub-item 2</li>
<li class="leaf">Sub-item 3</li>
</ul>
</li>
<li class="leaf last">Last item</li>
</ul>
</div>
CSS
#bg {
background-color: yellow;
width: 400px;
height: 50px;
}
ul {
float: left;
margin: 0;
padding: 0;
}
ul li {
position: relative;
float: left;
list-style: none;
list-style-image: none;
padding: .5em 1em;
margin: 0;
cursor: pointer;
}
ul li ul {
display: none;
position: absolute;
width: 120px;
left: 0;
top: 50px;
}
ul li:hover ul {
display: block;
}