I need some smart-people help. I've wracked my brain on this and I am close, but just cannot get my sub-sub menu items to drop to the right on hover.
I probably have conflicting or reiterative css, but I've removed parts and put back other parts, and... I just need to see if something jumps out to you guys, I'm sure it will.. - I feel like I'm close but.. no cigar. I took two menus and tried to use parts of each (had ability to do 2 column and other had sub menus) so I know this can be simplified way more.
I'd really appreciate it - I know its a mess at this point, there's more than needed for this simple section of html I have drilled down to, but if you can just see where the problem is -- I'm looking for the uls for Toy 1 and Toy 3 to drop down on hover. Thanks.
html
<!-- drop menu-->
<ul id="menu">
<li>TOYS
<div class="menu-container-1">
<ul class="column-1">
<li><span>Toy 1</span>
<ul>
<li>sub menu basic 1</li>
</ul>
</li>
<li>Toy 2</li>
<li><span>Toy 3</span>
<ul>
<li>sub menu basic 3</li>
</ul>
</li>
<li>Toy 4</li>
</ul>
</div>
</li>
</ul>
and here is the css:
#menu li {
float:left;
display:block;
position:relative;
text-align:center;
padding:4px 18px;
margin:0px 27px 0 0;
border:none; }
#menu li:hover {
border-width:0 0 0 1px;border-style:solid;border-color:#F1F7FC;
padding:4px 18px 4px 17px;
display:block; }
#menu li a {
font-family:Arial, Helvetica, sans-serif;
font-size:16px/1.8em;
color: #000;
display:block;
outline:0;
text-decoration:none;
font-weight:500; }
#menu li:hover a {
color:#161616; }
/* menu containers here */
#menu .menu-container-1,#menu .menu-container-2,#menu .menu-container-3,#menu .menu-container-4 {
margin:4px auto;
float:left;
position:absolute;
left:-999em;
text-align:left;
padding:10px 5px 3px 5px;
border:1px solid #D8E9F8; /* border around dropdown */
border-top:none;
/* rounded corners */
border-radius:0 5px 5px 5px;
-moz-border-radius:0 5px 5px 5px;
-webkit-border-radius:0 5px 5px 5px;
/* gradient */
background:#ffffff;
background: -moz-linear-gradient(center top, #ffffff, #FAFCFE) repeat scroll 0 0 transparent;
background:-webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#FAFCFE));
box-shadow:inset .4px -2px 3px 2px #EFFFFF; }
#menu .menu-container-1 {
width:165px; }
#menu .menu-container-2 {
width:340px; }
#menu li:hover .menu-container-1, #menu li:hover .menu-container-2, #menu li:hover .menu-container-3, #menu li:hover .menu-container-4 {
top:auto;left:-1px; }
/* columns */
#menu .column-1, #menu .column-2 {
display:inline; float:left;position:relative;margin:0;}
/*added 7/9 for span arrow sub menu */
#menu span{
display:block;overflow:visible;background-position:right center;background-repeat:no-repeat;padding-right:0px;}
#menu ul span{
background-image:url("https://www.kqimageserver.com/other/arrowsub.png");padding-right:12px;}
/*thought might be sub menu */
#menu ul ul {
position:absolute;left:80%;top:0;}
#menu .column-1 {
width:165px;}
#menu ul li ul li{ display:none;}
#menu ul li ul li ul li hover>* {display:block; }
/* attempts to get sub menu to show on hover */
#menu .column-1 ul li ul li:hover>*{
display:block;position:absolute;left:80%;top:0;}
#menu li:hover div a {
box-shadow: 0 1px 0 #eeeeee, 0 2px 0 #eeeeee; /*lines between list items */
color: #000;
font-size: 13px;
padding-left: 6px;
font-weight:500;
width: 159px; }
#menu li:hover div a:hover {
background: -moz-linear-gradient(#04ACEC, #0186BA) repeat scroll 0 0 transparent;
background:-webkit-gradient(linear, left top, left bottom, from(#04ACEC), to(#0186BA));
color: #000;
background:#deeff7;}
#menu li ul {
/*box-shadow: 0 1px 0 #111111, 0 2px 0 #777777; */
list-style:none;
padding:0;
margin-bottom:7px;}
#menu li ul li {
float: none;
font-size: 12px;
line-height: 24px;
margin: 0;
padding: 0;
position: relative;
text-align: left;
width: 130px;}
#menu li ul li:hover {
background: none;
border: medium none;
margin: 0;
padding: 0; }
Here is a js-fiddle
http://jsfiddle.net/tousif123/TfhLb/
Try
removing
#menu ul li ul li {
display: none;
}
and adding
ul.column-1 li ul
{
display:none;
}
ul.column-1 li:hover ul
{
display:block;
}
Heres a js-fiddle
http://jsfiddle.net/tousif123/brBj5/
You just bave a bad selector for your block display:
#menu ul li ul li ul li hover>* {display:block; }
It should read
#menu ul li:hover ul li { display: block; }
Using display:none and display:block isn't very accessible.
Ultimately, if you have the time and patience the best thing to do is to use the clip technique. It will hide content when it isn't needed, but also keep it accessible:
http://developer.yahoo.com/blogs/ydn/clip-hidden-content-better-accessibility-53456.html
Related
So after many hours of Google searches and many more editing and trying to understand CSS code for drop down menus in Blogger (Why doesn't Google just provide a widget for these anyway???), I now have an example that is 98% of the way to what I want. The HTML and CSS are attached. I'd really to make 2 changes which I couldn't figure out.
I'd like the top level menu to be centered on the page. Sounds easy but I didn't find it so
Under the PORTFOLIO menu, WILDLIFE/NATURE submenu, I'd like to shift the box of the the subsubmenu to be completely off of its parent menu, i.e. so no menu items in the PORTFOLIO menu are hidden.
I can live with this the way it is but if I can get these last 2 things done, I'd be golden. Thanks.
#cssnav {
float: left;
overflow: hidden;
}
#cssnav ul {
width: 100%;
margin: 0;
padding: 0px;
list-style:none;
}
#cssnav ul li {
float:left;
}
#cssnav ul li a {
float: left;
font: 16px Verdana, Helvetica, Sans-serif;
color:black;
padding: 10px 40px; /*1st number is top & bottom. 2nd is left & rght. */
text-decoration:none;
}
#cssnav ul li a:hover,
#cssnav ul li:hover > a {
color: black; /* main menu hover color */
}
#cssnav li ul a:hover,
#cssnav ul li li:hover > a {
color: black; /*submenu text color */
text-shadow: 0 1px rgba(255, 255, 255, 0.3);
}
#cssnav li ul {
left: -999em;
margin: 35px 0 0;
position: absolute;
width: 340px; /* width of submenu box */
z-index: 9999;
}
#cssnav li:hover ul {
left: auto; /* where the left edge of the drop down box aligns */
}
/* Drop down box formatting */
#cssnav li ul a {
margin-right: 0;
width: 260px;
border-bottom: 1px solid transparent;
border-top: 1px solid transparent;
}
#cssnav li li ul {
margin: -1px 0 0 160px;
visibility:hidden;
}
/* no idea what this does */
#cssnav li li:hover ul {
visibility:visible;
}
<div id="cssnav">
<ul>
<li>HOME</li>
<li>PORTFOLIO
<ul>
<li><a ref='http://www.adahighlanderphotography.com/Products/Landscapes'>
LANDSCAPES</a></li>
<li><a href=' '>WILDLIFE/NATURE</a>
<ul>
<li><a href='http://www.adahighlanderphotography.com/Products/WildlifeFlowers-1/Birds/'>
BIRDS</a></li>
<li><a href='http://www.adahighlanderphotography.com/Products/WildlifeFlowers-1/Butterflies/'>BUTTERFLIES</a></li>
<li><a href='http://www.adahighlanderphotography.com/Products/WildlifeFlowers-1/Flowers/'>FLOWERS</a></li>
</ul>
</li>
<li><a href='http://www.adahighlanderphotography.com/Products/2017-Photo-of-the-Week/'>PHOTO OF THE WEEK</a></li>
<li><a href='http://www.adahighlanderphotography.com/Products/Landscapes-1/2017-Michigan-Calendar-Photos/'>2017 CALENDAR PHOTOS</a></li>
<li><a href='http://www.adahighlanderphotography.com/Products/Notecards'>
NOTECARDS</a></li>
</ul>
<li>CONTACT ME</li>
<li>ABOUT ME</li>
</li></ul>
</div>
I've modified your code to achieve what you're looking for. I put width: 100% on your main navigation div, and used text-align: center and display: inline-block to center the menu.
Formatting the subnavs was a little more complicated. I added position: relative to the li elements so we could position the sub navs around their parents. In order to get the third-level subnav off of its parent, I applied left: 100% to it to move it all the way to the side. I also removed the margin style on the sub nav under Wildlife.
I also added some drop-shadow and additional :hover styling to make the experience a little better for the user.
Hope this helps! More comments in the CSS.
#cssnav {
width: 100%; /* Spanned div across page */
text-align: center; /* Centered <ul> inside */
}
#cssnav ul {
display: inline-block; /* Allows text-align:center to affect Menu */
margin: 0;
padding: 0px;
list-style:none;
}
#cssnav ul li {
float:left;
text-align: left; /* Keeps menus left aligned */
position: relative; /* Allows us to position sub menus relative to their parent */
}
#cssnav ul li a {
float: left;
font: 16px Verdana, Helvetica, Sans-serif;
color:black;
padding: 10px 40px; /*1st number is top & bottom. 2nd is left & rght. */
text-decoration:none;
}
#cssnav ul li a:hover,
#cssnav ul li:hover > a {
color: black; /* main menu hover color */
background: rgba(0,0,0,0.1);
}
#cssnav li ul a:hover,
#cssnav ul li li:hover > a {
color: black; /*submenu text color */
text-shadow: 0 1px rgba(255, 255, 255, 0.3);
}
#cssnav li ul {
left: 0;
display: none;
margin: 35px 0 0;
position: absolute;
width: 340px; /* width of submenu box */
z-index: 9999;
background: white;
box-shadow: 0px 6px 10px 0px rgba(0,0,0,0.25);
-webkit-padding-start:0px !important;
}
#cssnav li:hover ul {
display: block;
}
/* Drop down box formatting */
#cssnav li ul a {
margin-right: 0;
width: 260px;
border-bottom: 1px solid transparent;
border-top: 1px solid transparent;
}
#cssnav li li ul {
visibility:hidden;
}
/* no idea what this does */
#cssnav li li:hover ul {
visibility:visible;
left: 100%; /* Puts sub nav next to parent, not over it */
}
<div id="cssnav">
<ul>
<li>HOME</li>
<li>PORTFOLIO
<ul>
<li><a ref='http://www.adahighlanderphotography.com/Products/Landscapes'>
LANDSCAPES</a></li>
<li><a href=' '>WILDLIFE/NATURE</a>
<ul>
<li><a href='http://www.adahighlanderphotography.com/Products/WildlifeFlowers-1/Birds/'>
BIRDS</a></li>
<li><a href='http://www.adahighlanderphotography.com/Products/WildlifeFlowers-1/Butterflies/'>BUTTERFLIES</a></li>
<li><a href='http://www.adahighlanderphotography.com/Products/WildlifeFlowers-1/Flowers/'>FLOWERS</a></li>
</ul>
</li>
<li><a href='http://www.adahighlanderphotography.com/Products/2017-Photo-of-the-Week/'>PHOTO OF THE WEEK</a></li>
<li><a href='http://www.adahighlanderphotography.com/Products/Landscapes-1/2017-Michigan-Calendar-Photos/'>2017 CALENDAR PHOTOS</a></li>
<li><a href='http://www.adahighlanderphotography.com/Products/Notecards'>
NOTECARDS</a></li>
</ul>
<li>CONTACT ME</li>
<li>ABOUT ME</li>
</li></ul>
</div>
My website's demo navigation bar is like this in here https://jsfiddle.net/xzfy2ee2/.
Since the options for 'Faunas' is continuing to grow, I think it may be better to create a side menu. So I used all sorts of css :hover to achieve the result.
Although the functionality is robust enough, there is a wired grey line just after 'Asia' when I move the mouse onto 'Faunas' and calls out the dropdown menu. It's still there when I move the mouse onto 'Asia' to show the side menu 'Japan'.
The HTML/CSS for the navigation bar is shown here:
#nav a:hover
{
color: Silver;
}
#nav ul
{
list-style-type:none;
}
#nav ul li
{
display: inline-block;
}
#nav ul li:hover ul
{
display:block;
}
#nav ul ul
{
display: none;
position: absolute;
background-color: #888888;
border: 2.5px solid #A0A0A0;
border-top:0;
margin-left: 0px;
margin-right:2px;
min-width:80px;
}
#nav ul ul li
{
display: block;
}
#nav ul ul ul li
{
display: none;
position: absolute;
background-color: #888888;
border: 0px solid #A0A0A0;
border-top:0;
margin-left:115px;
margin-right:2px;
margin-top:-20px;
padding-right:5px;
min-width:80px;
}
#nav ul ul li:hover ul li
{
display:block;
}
#nav ul ul ul li:hover
{
display:block;
}
<div id="nav">
<ul>
<li>Home</li>
<li>Faunas
<ul style ="width:160px">
<li style="border-bottom:1px solid white;margin-bottom:3px">About</li>
<li style="border-bottom:1px solid white;margin-bottom:7px">World</li>
<li style="border-bottom:1px solid white;margin-bottom:2px">
Asia
<ul>
<li>Japan</li>
</ul>
</li>
<li>Albania</li>
<li>Bulgaria</li>
<li>Chile</li>
<li>Colombia</li>
<li>France</li>
<li>Italy</li>
<li>Japan</li>
<li>Macedonia</li>
<li>Poland</li>
<li>Serbia</li>
<li>Slovenia</li>
<li>South Africa</li>
<li>United Kingdom</li>
<li>United States</li>
</ul>
</li>
</ul>
</div>
I didn't find anything to do with the gray line. I wonder what exactly is the line there? And is there any way to remove it?
you have unnecessary border: 2.5px solid #A0A0A0; applied to #nav ul ul (which covers both 1st and 2nd level dropdowns)
here's working jsfiddle https://jsfiddle.net/Lt4udmpt/
#nav ul ul
{
display: none;
position: absolute;
background-color: #888888;
border-bottom: 2.5px solid #A0A0A0;
border-top:0;
margin-left: 0px;
margin-right:2px;
min-width:80px;
}
In this part of code border-bottom: 2.5px solid #A0A0A0; is the problem! It is causing the child ul tag to have border too!
Solution:
In css:
Border removed from #nav ul ul and added border to specific second ul
#nav ul ul
{
display: none;
position: absolute;
background-color: #888888;
border-bottom: 2.5px solid #A0A0A0;
border-top:0;
margin-left: 0px;
margin-right:2px;
min-width:80px;
}
#nav ul #second
{
border: 2.5px solid red;
}
In Html:
Assign an id to the ul
<ul id="second" style ="width:160px" >
If you just don't need the boder than delete border-bottom: 2.5px solid #A0A0A0; this line from #nav ul ul
update at jsfiddle
Looks like the #nav ul ul border-bottom element is the culprit.
#nav ul ul
{
border-bottom: 2.5px solid #A0A0A0; <-----delete
}
Here I have my website: http://gyazo.com/56e069ebf8b5bd61ee30523886180b88
There are a number of issues with the nav bar.
1.You can see that the text or nav bar is not horizontally centered, as indicated by the hover (which is equal on top and bottom)
2.There is to much space in between the text, (and this spacing is the only way I've found works without the text moving around when highlighting or hovering.
So for 1. is there a way I can make the text or the nav bar (not sure what is the cause) centre so the hover looks more equal (horizontally)
For 2. Is there a way I can close the gap between the text, while still keeping the same padding settings, and so it doesn't move the text around when I use the hover function.
I've also added a jsfiddle if that helps: http://jsfiddle.net/d1a5eshs/
HTML FOR NAV BAR
<!--TOP NAV BAR SECTION-->
<div id="nav_bar">
<ul>
<li>HOME
</li>
<li>STATUS
</li>
<li>INFO
</li>
<li>GAMEMODES
<ul>
<li>SURVIVAL
</li>
<li><br>PURE-PVP
</li>
<li><br>GAMESWORLD
</li>
</ul>
</li>
<li>RULES
</li>
<li>VOTE
</li>
<li>CONTACT
</li>
</ul
CSS FOR NAV BAR
/*TOP NAV BAR SECTION*/
#nav_bar {
background-color: #a22b2f;
padding:1px;
box-shadow: 0px 2px
height:45px;
}
#nav_bar ul li {
display: inline-block;
}
#nav_bar ul li a {
color: white;
text-decoration:none;
font-weight:bold;
font-size:15px;
margin-left:10px;
padding-bottom:13px;
padding-top:17px;
padding-left:10px;
padding-right:10px;
margin-bottom:30px;
}
#nav_bar ul li ul {
display: none;
}
#nav_bar>ul>li>a:hover {
background:#8c1b1f;
padding-bottom:13px;
padding-top:13px;
padding-left:10px;
padding-right:10px;
}
#nav_bar>ul>li>ul>li>a:hover {
background:#c9c9c9;
padding-bottom:5px;
padding-top:5px;
padding-left:5px;
padding-right:5px;
}
#nav_bar ul li:hover ul {
display: block;
position: absolute;
padding: 0px;
background: #e2e2e2;
padding-top:10px;
padding-bottom:10px;
padding-left:0px;
padding-right:10px;
border: 1px solid black;
border-radius:5px;
}
#nav_bar ul li:hover ul li {
display: block;
}
#nav_bar ul li:hover ul li a {
color: black;
font-size:12px;
font-weight:bol;
margin-left:-20px;
padding-bottom:5px;
padding-top:5px;
padding-left:5px;
padding-right:5px;
}
There were several spacing issues and also there were several duplicate styles and a few mistakes, but I think I fixed all your issues. http://jsfiddle.net/d1a5eshs/1/.
Here's my version of your navigation bar: http://jsfiddle.net/zo541am2/. I trimmed and simplified both your HTML and CSS code.
HTML:
<nav>
<ul>
<li>HOME</li>
<li>STATUS</li>
<li>INFO</li>
<li>GAMEMODES
<ul>
<li>SURVIVAL</li>
<li>PURE-PVP</li>
<li>GAMESWORLD</li>
</ul>
</li>
<li>RULES</li>
<li>VOTE</li>
<li>CONTACT</li>
</ul>
</nav>
CSS:
* {
margin: 0;
padding: 0;
}
body {
padding: 10px;
}
nav {
background-color: #a22b2f;
box-shadow: 0px 2px 10px;
}
ul {
list-style-type: none;
}
nav > ul {
display: table;
margin: 0 auto;
min-width: 650px;
text-align: center;
}
nav > ul > li {
display: inline-block;
position: relative;
}
nav > ul > li > a {
display: block;
color: #fff;
text-decoration: none;
font: bold 15px/3 Serif;
padding: 0 15px;
}
nav ul ul {
display: none;
position: absolute;
min-width: 100%;
background: #e2e2e2;
border: 1px solid gray;
border-radius: 2px;
}
nav > ul > li:hover > a {
background: #8c1b1f;
}
nav ul ul li a {
display: block;
color: black;
font: bold 12px/3 Sans-Serif;
text-decoration: none;
}
nav ul ul > li:hover > a {
background: #c9c9c9;
}
nav > ul > li:hover > ul {
display: block;
}
Here is the page I am working on: http://www.sackling.com/new_arrivals.php
It seems to look good in all browsers except ie7.
I can't seem to figure out a way to make it work properly in all browsers it must be something with the way I am trying to stack my divs..
This is the important css:
#menuwrap {
width:940px;
height:84px;
position:relative;
z-index:99999;
}
.top_menu_container {height:60px;}
.menu_holder {width:980px; z-index:9999;}
.menu_right_bottom {width:220px; }
/*Menu Start */
.navtest{list-style:none;}
.navtest ul li {
display: block;
position: relative;
float: left;
cursor:pointer;
z-index:9999;
position:static;
}
.navtest ul li a {
text-transform:uppercase;
font-size: 11px;
display: block;
text-decoration: none;
color: #3F3F41;
padding: 5px 21px 5px 20px;
margin-left: 1px;
white-space: nowrap;
z-index:9999;
font-weight:normal;
text-shadow: 0px 1px 1px rgba(0,0,0,0.3);
}
.navtest ul li ul { opacity:0.80; width:141px; display:none; }
.navtest ul li:hover ul{ display: block; position: absolute; z-index:9999; }
.navtest ul li:hover li { float: none; z-index:9999;}
.navtest ul li:hover a { background: #fff; z-index:9999; color: #999; } /* main menu rollover color change */
.navtest ul li a:active {text-shadow: 0px 0px 0px rgba(0,0,0,0);} /*main menu click */
.navtest ul li:hover li a:hover { background: #c0c1c0; z-index:9999;} /*hover over background of dropdown */
.navtest ul li:hover ul li a {color:#000;} /* color of drop down on main rollover */
.top_buttons .navtest ul li a { font-size: 10px; } /* top menu row font */
*{margin:0; padding:0;}
body { margin: 0 auto; font-size: 13px; color: #333333; }
html, body { color: #000000; margin:0; padding:0; height:100%; font-family:"Lucida Grande","Lucida Sans Unicode","Lucida Sans","DejaVu Sans","Bitstream Vera Sans","Liberation Sans",Verdana,"Verdana Ref",sans-serif; }
.header_space { height: 15px;; clear: both; width:940px; margin:0 auto;}
.wrapper {width:940px; margin-left:20px; margin-right:20px; background:#fff; overflow:hidden; margin:0 auto; }
.container {min-height:100%; height: auto !important; height:100%; margin: 0 auto -25px; width:980px; background:URL(images/bg_sides.jpg) repeat-y #f4f4f4; }
.contentContainer {width:980px;}
.banner_listings {margin:0; padding:0; height:293px; width:940px;}
.category_product_style {padding:10px 0px 0px 13px;}
#account_content {background: url(/images/account_nav_bg.png) repeat-x left top; margin-top:35px;}
/* =Account nav */
#account_nav {margin-bottom:55px; margin-top:35px; background: url(/images/account_nav_bg.png) repeat-x left top; float: left; width: 180px;}
#account_nav h2, .table_legend h2, #account_credits h2 { font-size:125%;}
/***********header stuff ************************/
.styled-select {padding-top:6px;}
#searchwrapper {
width:246px; /*follow your image's size*/
height:26px;/*follow your image's size*/
background:#ccc;
background-repeat:no-repeat; /*important*/
padding:0px;
margin:0px;
position:relative; /*important*/
}
#searchwrapper form { display:inline ; }
.searchbox {
border:none; /*important*/
background-color:transparent; /*important*/
background-image:url(images/blank_search.gif);
position:absolute; /*important*/
top:7px;
left:9px;
width:225px;
height:14px;
color:#fff;
font-size:14px;
margin:0px;
}
.searchbox_submit {
border:none; /*important*/ /*important*/
background: url(images/searcharrow.jpg) no-repeat;
position:absolute; /*important*/
top:3px;
left:225px;
width:15px;
height:20px;
margin:0px;
}
Try removing all whitespaces within the ul's in the menu - IE7 renders 2 spaces just above the first menu.
EDIT: i think it's the redundant ul/li - try changing ul class"navtest" to div class="navtest", and remove the li in the left & right menu...
I believe your issue is with the ul#nav-test element. For some reason you have a ul nested within an li within a ul. Was this a mistake or have you done this for a reason?
See line 92 :
<ul class="navtest" >
<li>
<ul>
<li>Fall Catalog</li>
<li>Contact us</li>
</ul>
</li>
</ul>
Remove the additional ul and this will probably resolve your issue as IE7 is assigning a 16px offset from the top of the second ul.
So your HTML becomes:
<ul class="navtest" >
<li>Fall Catalog</li>
<li>Contact us</li>
</ul>
Here's the link to the page:
http://themes.brixwork.com/altamont/
The positioning of the tags under the ul#menu appears to be skewed on IE7. I have put borders on the UL (#f00) and LI (#0f0) items to clarify.
IN Firefox, the LI items nest properly to the top of the UL, however on IE the LI nests to the top of the div#menubar rather than the ul#menu under it.
The DOM tree is like this:
<div id="menubar" class="grid_16 alpha omega">
<ul id="menu">
<li style="margin-left:0px;">home</li>
<li>about me</li>
<li>featured listings
<ul class="submenu">
<li>
on a map
</li>
</ul>
</li>
<li>
MLS® search
</li>
<li>
resources
<ul class="submenu">
<li>
for buyers
</li>
<li>
for sellers
</li>
<li>
pre-sale / assignment
</li>
<li>
useful links
</li>
</ul>
</li>
<li>
blog
</li>
<li>
contact me
</li>
</ul>
</div>
Pretty standard div>ul>li menu structure, with optional submenus under each as a ul.submenu>li structure.
I tried putting a "float:left;" to the #menu li node, and that did solve the positioning; however then I don't have a nice centre aligned menu - everything goes to the left on the menu.
Here's the current css revolving around this (note that I'm using 960 grid, and also the reset.css and text.css file that comes with it).
#menubar {
height:40px;
text-align: center;
}
#menu {
margin:10px auto;
padding:0px;
z-index: 20;
width: auto;
display: block;
list-style:none;
white-space: nowrap;
position: relative;
border: 1px solid #f00;
}
#menu li {
display:inline;
margin-left:40px;
margin-right:0px;
margin-top:10px;
margin-bottom:0px;
padding:0px 0px 0px 0px;
list-style:none;
z-index: 25;
position: relative !important;
border: 1px solid #0f0;
}
#menu li a:link, #menu li a:visited {
color:#fff;
text-decoration:none;
font-size:12px;
padding: 10px 0px;
text-transform: uppercase;
}
#menu li a:hover {
color:#ddd;
}
#menu li a:active {
position:relative;
top:1px;
color:#fff;
}
.submenu {
position:absolute;
left: -9999px;
display: block;
background-color:#906117;
padding:0px 0px 0px 0px;
top:0px;
z-index:30;
}
#menu li:hover .submenu {
left: 0px;
}
.submenu li {
text-align: left !important;
margin:0px !important;
padding: 3px 0px 5px 0px !important;
clear: both;
float: left;
position:relative;
overflow: hidden;
z-index: 35;
width: 100% !important;
}
.submenu li:hover {
background-color: #f79c10;
}
.submenu li a:link, .submenu li a:visited {
color:#fff !important;
font-size:12px !important;
padding: 0px !important;
margin: 0px !important;
white-space:nowrap;
display: block;
width: 100%;
padding:3px 10px 5px 10px !important;
z-index: 40;
}
.submenu li a:hover, .submenu li a:active {
color:#fff !important;
}
IE7 ignores margins when ul elements have a relative position. You can fix this by removing the margin in your ul#menu styles and add that value back in the parent div#menubar.
This will give you the same layout result, but will resolve the IE7 margin/relative bug.