Begining to create an 2 Layer Horizontal menu.
Can some one have a idea on whats missing here.
- It’s not working properly in Internet Explorer 7.
- I need to maintain a a certain gap between the parent and child menu, while hovering from the parent to the child, when the mouse reaches the gap, the child menu disappears, unless the mouse is moved really fast & that seems unreasonable. I know by not having the gap the problem could be fixed, but is there a solution to this.
Here is the HTML
<div id="Nav">
<ul>
<li><a href="#">Home 1</a></li>
<li><a href="#">Home 2</a></li>
<li><a href="#">Home 3</a>
<ul>
<li><a href="#">Sub 1</a></li>
<li><a href="#">Sub 2</a></li>
<li><a href="#">Sub 3</a></li>
</ul>
</li>
<li><a href="#" >Home 4</a></li>
</ul>
</div>
Here is the Css
<style type=“text/css”>
#Nav ul
{
margin-top:10em;
list-style:none;
}
#Nav ul li
{
float:left;
position:relative;
display:inline;
padding:0.5em;
border:solid red 1px;
}
#Nav ul li ul
{
position:absolute;
display:none;
margin-top:1.5em;
margin-left:-3em;
}
#Nav ul li ul li
{
}
#Nav ul li a
{
text-decoration:none;
width:6em;
text-align:center;
}
#Nav ul li a:hover
{
text-decoration:none;
width:6em;
text-align:center;
}
#Nav li:hover ul {display:block;}
#Nav li.over ul {display:block;}
</style>
Im just begining on css , so any improvement suggestions are welcome.
Here I thought, display:inline is what makes the child menu go vertical or horizontal but here it looks like position:relative attribute of #Nav ul li
makes it change. any one know how does that works.
Thanks.