My navigation menu uses CSS to show a dropdown menu on hover.
It works fine in firefox and chrome but in IE it is completely broke.
Everytime I move the mouse away from a menu item, the hover menu disappears instantly restricting me from clicking on a sub menu in time.
I am using IE9 and got the css code from a few tutorial sites, and someone on here helped me with the rest a few weeks ago but I am only just noticing this problem now as I use firefox mainly.
As you can see I had to use padding-bottom on the ul li so the sub menu aligns perfectly with the bottom of the navigation bar.
If I change the ul li “padding-bottom: 6px” to “5px” then it works fine in IE, but obviously it doesn’t look very good due to overlapping.
I was thinking about maybe having a bit of code to change this to 5px if the browser is IE but I am sure there might be better ways?
And now update your HTML…
<nav class=“nav_main clearfix”>
You should know that <nav>, being HTML5, isn’t supported at all in IE8 and down, so your page is essentially busted completely in those browsers. I switched it to <div> instead in my local file.
Some things noteworthy: You were using display:none to hide/show the dropdown. Don’t do that :). In my example I used a negative left margin to hide, and then set to 0 to show (you already defined margin-left:0; on the hover code anyway so it worked otu perfectly). Also, I changed the coordinates set for the AP dropdown to %'s instead of pt, and I removed the height of the <nav> container, allowing the content to dictate the height. Thus the clearfix code at the bottom of the CSS file is needed to contain floated elements
Rule of thumb, you can’t leave the browser to guess the height on delicate situations like yours (I know I am arguing with myself) where the dropdown must match up with the image :). If it has to round the height, some round up, some round down.
I didn’t give the anchor a 30px height. If I did that was a mistake. Remove it and see if it’sstill fixed.
You have the div to 30px height. In order to prevent rounding errors, and for visual purposes, I put a 4px top padding on the <li> (IIRC) and 6px bottom padding plus the 4px top padding + 20px height = the 30px height. Matches the div :).
All is for nought though, if text is resized. Should really convert all those px based values off of ems so that it’ll scale with text resize.