CSS Horizontal Menu drop-downs behind content in IE8 and earlier
My website uses a horizontal CSS (only) menu with CSS content and the site works fine in Firefox 5+, IE9, and Chrome, but in IE8 and earlier the drop-down options are behind the content boxes. I have tried z-index solutions found here and elsewhere without success. It's possibly my inexperience with CSS, but I really need to get this working. Any help would be appreciated.
body #css_menu {
font-family: Arial, Helvetica, sans-serif;
font-size: 9px;
}
#css_menu {
/* width of menu */
width: 98%;
/* center menu tabs or not */
text-align:center;
/* put your positioning statements here */
margin: 0px 0px 10px 0px; padding: 0 0 0 0;
z-index: 500;
}
/*-----HEIGHT OF ITEMS */
/* all menu items */
#css_menu { height: 25px; }
#css_menu a
{
line-height:25px;
text-decoration: none;
}
/* all hover items */
#css_menu a:hover ul,
#css_menu li.left a:hover ul,
#css_menu ul li:hover > ul,
#css_menu li.left:hover > ul { top:25px; z-index: 500;}
/* flyout positioning - this number must remain negative */
#css_menu ul ul li:hover > ul,
#css_menu li.left ul li:hover > ul { margin-top:-25px;}
/*-----*/
/* ITEM ARROWS AND FONT STYLING WHEN ITEM HAS DROPDOWNS AND FLYOUTS */
/* menu arrow down */
#css_menu li a.down {
background:transparent url(arrow-down-white.gif) no-repeat right center;
}
/* menu arrow right, font color and weight when item has flyouts */
#css_menu li ul a.flyout {
background:#868686 url(arrow-right-black.gif) no-repeat right center;
color: #FFFFFF;
/* bold or not */
font-weight: bold;
/* uppercase or not */
text-transform: capitalize;
}
/* menu arrow left, font color and weight when item has flyouts */
#css_menu li.left ul a.flyout {
background:#868686 url(arrow-left-black.gif) no-repeat left center;
color: #FFFFFF;
/* bold or not */
font-weight: bold;
/* uppercase or not */
text-transform: capitalize;
}
/* ITEM BACKGROUND, BORDER AND FONT STYLING */
/* level one: main menu and default font styling */
#css_menu {
/* remove background to get floating tabs */
/* font family if desired */
/*font-family: Verdana,Arial,sans-serif;*/
/* cursor style */
cursor: pointer;
/* border if desired
border: 1px solid #FFFFFF;
border-width: 0px 1px -20px 1px; */
z-index: 500;
}
/* level one; main menu tabs */
#css_menu ul.level1 { background:transparent; }
#css_menu ul.level1 a {
background: #000000;
color: #FFFFFF;
font-size: 1.2em;
/* bold or not */
font-weight: bold;
/* uppercase or not */
text-transform: uppercase;
/* letter spacing */
/*letter-spacing: 2px;*/
/* item padding */
padding:0 10px 0 10px;
margin:8px 5px 12px 5px;
/* border if desired */
border: 1px solid #FFFFFF;
border-width: 1px 1px 1px 1px;
z-index: 500;
}
/* level two dropdown */
#css_menu ul.level2 { background:transparent; }
#css_menu ul.level2 a {
background: #868686;
color: #FFFFFF;
font-size: 1.2em;
/* bold or not */
font-weight: bold;
/* uppercase or not */
text-transform: none;
/* letter spacing */
/*letter-spacing: 2px;*/
/* item padding */
margin: 15px 0px -15px 5px;
padding:0 20px 0 10px;
z-index: 500;
/* border if desired */
/*border: 1px solid #000000;
border-width: 1px 1px 1px 1px;*/
}
/* level three flyout */
#css_menu ul.level3 { background:transparent; }
#css_menu ul.level3 a {
background: #868686;
color: #FFFFFF;
font-size: 1.2em;
/* bold or not */
font-weight: bold;
/* uppercase or not */
text-transform: none;
/* letter spacing */
/*letter-spacing: 2px;*/
/* item padding */
padding:0 20px 0 10px;
margin:15px 0 -15px -15px;
z-index: 500;
/* border if desired */
/*border: 1px solid #000000;
border-width: 1px 1px 1px 1px;*/
}
/* level four flyout */
#css_menu ul.level4 { background:transparent; }
#css_menu ul.level4 a {
background: #868686;
color: #FFFFFF;
font-size: 1.2em;
/* bold or not */
font-weight: bold;
/* uppercase or not */
text-transform: none;
/* letter spacing */
/*letter-spacing: 2px;*/
/* item padding */
padding:0 20px 0 10px;
z-index: 500;
/* border if desired */
/*border: 1px solid #000000;
border-width: 1px 1px 1px 1px;*/
}
/* hover - these two should be the same */
#css_menu li a:hover,
#css_menu li a.flyout:hover {
background-color:#9C0000;
color: #FFFFFF;
/* bold or not */
font-weight: bold;
/* underline or not */
text-decoration:none;
}
#css_menu li:hover > a,
#css_menu ul li:hover > a.flyout {
background-color:#9C0000;
color: #FFFFFF;
/* bold or not */
font-weight: bold;
/* underline or not */
text-decoration:none;
}
You have more problems in IE7: http://prntscr.com/2qjvk. And your code is riddled with errors - see http://validator.w3.org/. Plus your css is riddled with comments, making it very awkward to work with.
The best advice I can give you is to do a (better) course in html + css, e.g. at http://htmldog.com, which is for free. Then, create your site under IE7, not under IE8.
Or have your site remade by a professional web designer, if you're in a hurry.
Bookmarks