The pure CSS nav bar on this site www.seventhheavenvintage.com works flawlessly in Webkit and FireFox. In ie8 and ie9 (I don’t have access to other versions) the presence of the grey ribbon png that serves as the nav bar’s background somehow interrupts the hover state of nested li’s. This means that when I hover over a menu item that has sub items, when I move my cursor down to click on one, the sub items disappear. If I move my cursor very quickly however, it works. All of this is corrected however, when I remove the ribbon img from the site.
What I’ve tried:
- tested various z-index rules
- swapped out the png for a jpg
- moved the png from the nav to the header above and positioned absolute
- created a barebones nav with the same html/css for a sanity check
A hint that may help in discovering what is going on here: If I absolute position the png higher or lower the point at which the hover state breaks also moves higher or lower in a directly related manner.
Here is the relevant HTML:
<nav class="main">
<img src="img/nav_ribbon_bw.png">
<img src="../img/menu_bg_bw.png" style="display:none;"> <!-- for preloading submenu backgrounds -->
<ul>
<li>
<a href="index.php">Home</a>
</li>
<li>
<a href="javascript:;">About<span style="font-size: 6pt;"> ▼</span></a>
<ul>
<li>
<a href="company.php">The Company</a>
</li>
<li>
<a href="team.php">The Team</a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">Services<span style="font-size: 6pt;"> ▼</span></a>
<ul>
<li>
<a href="rental.php">Rental Logistics</a>
</li>
<li>
<a href="event.php">Event Planning & Design (Weddings)</a>
</li>
<li>
<a href="styling.php">Prop Styling</a>
</li>
<li>
<a href="questions.php">Frequently Asked Questions</a>
</li>
</ul>
</li>
<li>
<a href="collection.php">Collection</a>
</li>
<li>
<a href="publication.php">Publications</a>
</li>
<li>
<a href="http://www.blog.seventhheavenvintage.com">Blog</a>
</li>
<li>
<a href="javascript:;" class="simpleCart_checkout">Contact</a>
</li>
</ul>
</nav>
Here is the relevant CSS:
nav.main {
width: inherit;
height: 40px;
margin: 0px 0px 32px 0px;
position: relative;
float: left;
}
nav.main > img {
width: 1102px;
position: absolute;
top:0px;
left: -71px;
display: block;
}
nav.main ul {
list-style-type: none;
text-align: center;
}
nav.main ul li {
display: inline-block;
position: relative;
margin: 0px 3px;
}
nav.main a {
display: block;
height: 40px;
padding: 0px 14px;
}
nav.main li ul {
display: none;
text-align: left;
}
nav.main li:hover ul {
display: block;
position: absolute;
z-index: 10;
background-image: url('../img/menu_bg_bw.png');
background-size: 4px 40px;
border-radius: 3px;
}