Connecting Tech Pros Worldwide Help | Site Map

IE7 unwanted behaviour CSS

Familiar Sight
 
Join Date: Nov 2006
Posts: 161
#1: Jun 2 '08
Hello,

I'm a little out of my depth with this one. There's a top dropdown nav menu which is just a bunch of ul and li etc. The style sheet (below) works perfectly with FF and Safari, but IE7 two things are wrong. (The menu is from Stu Nicholl's site.) I'm on Windows XP.

1) The dropdown part is "transparent". Is this some sort of z-index problem?
2) IE7 will only dropdown to the 1st sublevel, but no more. If you move the mouse below that to the next link in the set, the menu disappears.

Is anyone able to point me in the right direction please?
Html snippet
Expand|Select|Wrap|Line Numbers
  1. <ul id="nav">
  2.     <li class="top"><a href="index2.php" class="top_link"><span>Home</span></a></li>
  3.     <li class="top"><a href="calendar/mysqlcalindex.php" class="top_link"><span>Calendar</span></a></li>
  4.     <li class="top"><a href="javascript: void(0)" id="classes" class="top_link"><span class="down">Classes</span></a>
  5.         <ul class="sub">
  6.             <li><a href="classnew.php">New</a></li>
  7.             <li><a href="classview.php">View or Edit</a></li>
  8.             <li><a href="javascript: void(0)" class="fly">Usernames to Parents &rsaquo;</a>
  9.                 <ul>
  10.                     <li>
  11. ...etc
  12.  
CSS code
Expand|Select|Wrap|Line Numbers
  1. #nav, 
  2. #nav ul {padding:0 0 5px 0; margin:0; list-style:none; font: 10px verdana, sans-serif; border:1px solid #3a93d2; background:#3a93d2; position:relative; z-index:200;}
  3. #nav {height:25px; padding:0;}
  4.  
  5. #nav li {float:left;}
  6. #nav li li {float:none;}
  7. /* a hack for IE5.x and IE6 */
  8. * html #nav li li {float:left;}
  9.  
  10. #nav li a {display:block; float:left; color:#d8d8d8; margin:0 10px; height:25px; line-height:25px; text-decoration:none; white-space:nowrap;font-weight:bold}
  11. #nav li li a {height:20px; line-height:20px; float:none;}
  12.  
  13. #nav li:hover {position:relative; z-index:300; color:#fff}
  14. #nav li:hover ul {left:0; top:22px;background:white;}
  15. /* another hack for IE5.5 and IE6 */
  16. * html #nav li:hover ul {left:10px;background:white;}
  17.  
  18. #nav ul {position:absolute; left:-9999px; top:-9999px;}
  19. /* yet another hack for IE5.x and IE6 */
  20. * html #nav ul {width:1px;}
  21.  
  22. /* it could have been this simple if all browsers understood */
  23. /* show next level */
  24. #nav li:hover li:hover > ul {left:-15%; margin-left:100%; top:-1px;color:black;background:white;font-weight:bold}
  25. /* keep further levels hidden */
  26. #nav li:hover > ul ul {position:absolute; left:-9999px; top:-9999px; width:auto;color:black;background:white;font-weight:bold}
  27. /* show path followed */
  28. #nav li:hover > a {text-decoration:none;  font-weight:bold;color:white;background:#3a93d2}
  29.  
  30.  
  31. /* but IE5.x and IE6 need this lot to style the flyouts and path followed */
  32. /* show next level */
  33. #nav li:hover li:hover ul,
  34. #nav li:hover li:hover li:hover ul,
  35. #nav li:hover li:hover li:hover li:hover ul,
  36. #nav li:hover li:hover li:hover li:hover li:hover ul
  37. {left:-15%; margin-left:100%; top:-1px;color:black;background:white;font-weight:bold}
  38.  
  39. /* keep further levels hidden */
  40. #nav li:hover ul ul,
  41. #nav li:hover li:hover ul ul,
  42. #nav li:hover li:hover li:hover ul ul,
  43. #nav li:hover li:hover li:hover li:hover ul ul
  44. {position:absolute; left:-9999px; top:-9999px;color:black;background:white;font-weight:bold}
  45.  
  46. /* show path followed */
  47. #nav li:hover a,
  48. #nav li:hover li:hover a,
  49. #nav li:hover li:hover li:hover a,
  50. #nav li:hover li:hover li:hover li:hover a,
  51. #nav li:hover li:hover li:hover li:hover li:hover a,
  52. #nav li:hover li:hover li:hover li:hover li:hover li:hover a
  53. {text-decoration:none;  font-weight:bold;color:white;background:#3a93d2}
  54.  
  55. /* hide futher possible paths */
  56. #nav li:hover li a,
  57. #nav li:hover li:hover li a,
  58. #nav li:hover li:hover li:hover li a,
  59. #nav li:hover li:hover li:hover li:hover li a,
  60. #nav li:hover li:hover li:hover li:hover li:hover li a
  61. {text-decoration:none;  color:black;background:white;font-weight:bold}
  62.  
Stang02GT's Avatar
Moderator
 
Join Date: Jun 2007
Location: USA
Posts: 1,152
#2: Jun 2 '08

re: IE7 unwanted behaviour CSS


One thing you have to understand is that each of these browsers render things different then the other. Firefox handles things one way and IE will handle that same thing totally different.

Unfortunately i am unable to provide you with links to resources that can help you, most of with involve the word "hack" and my work blocks all sites containing words like that.

But if you do a google search on CSS IE7 fixes there are loads of articles and information on the issue.

here is one idea that you can attach a different style sheet for IE

http://css-tricks.com/how-to-create-...ly-stylesheet/
Familiar Sight
 
Join Date: Nov 2006
Posts: 161
#3: Jun 3 '08

re: IE7 unwanted behaviour CSS


Quote:

Originally Posted by Stang02GT

One thing you have to understand is that each of these browsers render things different then the other. Firefox handles things one way and IE will handle that same thing totally different.

Unfortunately i am unable to provide you with links to resources that can help you, most of with involve the word "hack" and my work blocks all sites containing words like that.

But if you do a google search on CSS IE7 fixes there are loads of articles and information on the issue.

here is one idea that you can attach a different style sheet for IE

http://css-tricks.com/how-to-create-...ly-stylesheet/


Thankyou Stang02GT for your response, I'll look into it.
Reply