Hi guys,
While starting my layout from scratch, I have come up against something that is taking me a long time to figure out and I can't find exactly what I want on google. Here is the html layout:
Here is my CSS:
Quite simple, the list is horizontal and once the top list is hovered upon, the bottom list is displayed (which changes for each top list item selected). I am trying to line the bottom list to be under the top list to the left most. If I use position:absolu te left:0 it will align to the left of the screen, not the div (800px in the center). I cannot use a negative margin because it will vary in magnitude, and I would prefer not giving id's to every item.
If that doesn't make sense, here is my site and if you just hover on the links you will see what I mean.
Thanks for your help.
While starting my layout from scratch, I have come up against something that is taking me a long time to figure out and I can't find exactly what I want on google. Here is the html layout:
Code:
<div id="top_menu"> <div id="nav"> <ul> <li><a href="#">Home</a> <ul> <li><a href="#"><span>Home</span></a></li> <li><a href="#"><span>Forums</span></a></li> </ul> </li> ... </ul> </div> </div>
Code:
#top_menu {
height: 60px;
width: 100%;
overflow: hidden;
margin: 0 auto;
background: gray url(top_menu_bg.png) repeat-x;
display: block;
text-align: center;
border: 2px gray ridge;
border-left: none;
border-right: none;
font-size: 16px;
}
#nav {
width: 100%;
}
#nav ul {
width: 800px;
margin: 0 auto;
display: block;
}
#nav ul ul {
font-size: 14px;
margin-top: 10px;
}
#nav ul ul li {
display: none;
height: 20px;
float: left;
width: 100px;
padding-top: 5px;
}
#nav ul li {
height: 30px;
width: 150px;
padding-top: 5px;
float: left;
list-style: none;
}
#nav ul li:hover ul li {
display: block;
}
If that doesn't make sense, here is my site and if you just hover on the links you will see what I mean.
Thanks for your help.
Comment