Solved

CSS drop down menu not working in IE, works in other browsers

Posted on 2013-06-27
3
498 Views
Last Modified: 2013-07-18
The dropdown menus under "The Magazine" and "About" aren't showing up on IE- they work on Chrome, Safari and Firefox.

website

html:
<ul id="nav">
																	<li class="top">
																		<A id="Nav_Magazine2" class="top_link" href="../Issues/Top.aspx"><span class="down">The 
																				Magazine</span></A>
																		<ul class="sub">
																			<li>
																				<A href="../Advertise/Top.aspx">Advertise</A>
																			<li>
																				<A href="../PickUpMag/Top.aspx">Pick Up the Mag</A>
																			<li>
																				<A href="../Subscribe/Top.aspx">Subscribe</A>
																			</li>
																		</ul>
																	</li>
																	<li class="top">
																		<A id="about" class="top_link" href="../About/Top.aspx"><span>About</span></A>
																		<ul class="sub">
																			<li>
																				<A href="../Team/Top.aspx">The Team</A>
																			<li>
																				<A href="../Contact/Contact.aspx">Contact Us</A>
																			</li>
																		</ul>
																	</li>
																	<li class="top">
																		<A id="events" class="top_link" href="../Events/Top.aspx"><span>Events</span></A>
																	</li>
																	<li class="top">
																		<A id="shop" class="top_link" href="../home-professionals/all.aspx"><span>Home 
																				Professionals</span></A>
																	</li>
																	<li class="top">
																		<A id="Radio_Show" class="top_link" href="../Radio/Top.aspx"><span>Radio</span></A>
																	</li>
																</ul>

Open in new window


CSS:

body
{
}
		
A:link	{	
	text-decoration:	none;
	color:	#3333cc;
	}	
		
A:visited	{	
	text-decoration:	none;
	color:	#333399;
	}			
		
A:hover	{	
	text-decoration:	none;
	color:	#3333cc;
	}
	

.preload1 {background: url(images/nav/three_1.jpg);}
.preload2 {background: url(images/nav/three_1a.jpg);}

#nav {padding:0; margin:0; list-style:none; height:38px; background:#fff url(images/nav/three_0.jpg) repeat-x; position:relative; z-index:500; font-family:helvetica, arial, verdana, sans-serif;}
#nav li.top {display:block; float:left; height:38px;}
#nav li a.top_link {display:block; float:left; height:33px; line-height:35px; color:#000000; text-decoration:none; font-size:15px;  padding:0 0 0 10px; cursor:pointer; background: url(images/nav/three_0.jpg);}
#nav li a.top_link span {float:left; display:block; padding:0 26px 0 14px; height:35px; background: url(images/nav/three_0.jpg) right top no-repeat;}
#nav li a.top_link span.down {float:left; display:block; padding:0 24px 0 12px; height:35px; background: url(images/nav/three_1a.jpg) no-repeat right top;}

#nav li:hover a.top_link {color:#556886; text-decoration:none; background: url(images/nav/three_1.jpg) no-repeat;}
#nav li:hover a.top_link span {background:url(images/nav/three_1.jpg) no-repeat right top;}
#nav li:hover a.top_link span.down {background:url(images/nav/three_1a.jpg) no-repeat right top;}

/* Default list styling */
#nav li:hover {position:relative; z-index:200;}

#nav li:hover ul.sub
{left:10px; top:36px; background: #000000; padding:3px; border:1px solid #ffffff; white-space:nowrap; width:115px; height:auto; z-index:300;}
#nav li:hover ul.sub li
{display:block; height:20px; position:static; float:left; width:115px; font-weight:normal;}
#nav li:hover ul.sub li a
{display:block; font-size:15px; height:18px; width:112px; line-height:18px; text-indent:5px; color:#ffffff; text-decoration:none;border:0px solid #E9E9E9;}
#nav li ul.sub li a.fly
{background:#000000 url(images/nav/arrow.gif) 80px 6px no-repeat;}
#nav li:hover ul.sub li a:hover 
{background:#000000; color:#E6E6E6; border-color:#fff;}
#nav li:hover ul.sub li a.fly:hover
{background:#000000 url(images/nav/arrow_over.gif) 80px 6px no-repeat; color:#fff;}
/*
#nav li:hover {position:relative; z-index:200;}

#nav li:hover ul.sub
{left:10px; top:36px; background: #000000; padding:3px; border:1px solid #ffffff; white-space:nowrap; width:115px; height:auto; z-index:300;}
#nav li:hover ul.sub li
{display:block; height:20px; position:static; float:left; width:115px; font-weight:normal;}
#nav li:hover ul.sub li a
{display:block; font-size:15px; height:18px; width:112px; line-height:18px; text-indent:5px; color:#ffffff; text-decoration:none;border:0px solid #E9E9E9;}
#nav li ul.sub li a.fly
{background:#000000 url(images/nav/arrow.gif) 80px 6px no-repeat;}
#nav li:hover ul.sub li a:hover 
{background:#000000; color:#E6E6E6; border-color:#fff;}
#nav li:hover ul.sub li a.fly:hover
{background:#000000 url(images/nav/arrow_over.gif) 80px 6px no-repeat; color:#fff;}
*/

#nav li:hover li:hover ul,
#nav li:hover li:hover li:hover ul,
#nav li:hover li:hover li:hover li:hover ul,
#nav li:hover li:hover li:hover li:hover li:hover ul
{left:90px; top:-4px; background: #bbd37e; padding:3px; border:1px solid #5c731e; white-space:nowrap; width:90px; z-index:400; height:auto;}

#nav ul, 
#nav li:hover ul ul,
#nav li:hover li:hover ul ul,
#nav li:hover li:hover li:hover ul ul,
#nav li:hover li:hover li:hover li:hover ul ul
{position:absolute; left:-9999px; top:-9999px; width:0; height:0; margin:0; padding:0; list-style:none;}

#nav li:hover li:hover a.fly,
#nav li:hover li:hover li:hover a.fly,
#nav li:hover li:hover li:hover li:hover a.fly,
#nav li:hover li:hover li:hover li:hover li:hover a.fly
{background:#6a812c url(images/nav/arrow_over.gif) 80px 6px no-repeat; color:#fff; border-color:#fff;} 

#nav li:hover li:hover li a.fly,
#nav li:hover li:hover li:hover li a.fly,
#nav li:hover li:hover li:hover li:hover li a.fly
{background:#bbd37e url(images/nav/arrow.gif) 80px 6px no-repeat; color:#000; border-color:#bbd37e;} 

Open in new window

0
Comment
Question by:JChrisMcNeil
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 4

Expert Comment

by:ScorchD
ID: 39282807
Rather than moving the element on and off the screen like you would to hide text you should just use  visibility: hidden; and then visibility: visible; on hover for your sub. You may also consider just using it like this
#nav li:hover > ul

Open in new window

If you intend to have multiple levels.

Regards,
0
 

Author Comment

by:JChrisMcNeil
ID: 39288687
Where, specifically, would you make those changes in the code?
0
 
LVL 27

Accepted Solution

by:
skullnobrains earned 500 total points
ID: 39298122
the code is really messy so i just did the following

- remove a bunch of hover until the menus are visible
- remove a few comments
- add the 2 last blocks. i used display hidden VS block but visibility would have worked equivalently

body
{
}
		
A:link	{	
	text-decoration:	none;
	color:	#3333cc;
	}	
		
A:visited	{	
	text-decoration:	none;
	color:	#333399;
	}			
		
A:hover	{	
	text-decoration:	none;
	color:	#3333cc;
	}
	

.preload1 {background: url(images/nav/three_1.jpg);}
.preload2 {background: url(images/nav/three_1a.jpg);}

#nav 
{
	padding:0; 
	margin:0; 
	list-style:none; 
	height:38px; 
	background:#fff url(images/nav/three_0.jpg) repeat-x; 
	position:relative; 
	z-index:500; 
	font-family:helvetica, arial, verdana, sans-serif;
	position:relative;/* absolute positioning on dropdown relative to this*/
}
#nav li.top 
{
	display:block; 
	float:left; 
	height:38px;
	position:relative;/* absolute positioning on dropdown relative to this*/
}
#nav li a.top_link 
{
	display:block; 
	float:left; 
	height:33px; 
	line-height:35px; 
	color:#000000; 
	text-decoration:none; 
	font-size:15px;  
	padding:0 0 0 10px; 
	/*cursor:pointer;*/
	background: url(images/nav/three_0.jpg);
}
#nav li a.top_link span {float:left; display:block; padding:0 26px 0 14px; height:35px; background: url(images/nav/three_0.jpg) right top no-repeat;}
#nav li a.top_link span.down {float:left; display:block; padding:0 24px 0 12px; height:35px; background: url(images/nav/three_1a.jpg) no-repeat right top;}

#nav li:hover a.top_link {color:#556886; text-decoration:none; background: url(images/nav/three_1.jpg) no-repeat;}
#nav li:hover a.top_link span {background:url(images/nav/three_1.jpg) no-repeat right top;}
#nav li:hover a.top_link span.down {background:url(images/nav/three_1a.jpg) no-repeat right top;}

/* Default list styling */
#nav li:hover 
{
	position:relative; 
	z-index:200;
	top:0px;/*set top position otherwise IE overlaps the main navbar*/
	display:block;/*sorts out the non-appearance on :hover in IE*/
}

#nav li ul.sub
{
	left:10px; 
	top:36px; 
	background: #000000; 
	padding:3px; 
	border:1px solid #ffffff; 
	white-space:nowrap; 
	width:115px; 
	height:auto; 
	z-index:300;
	/*top:0px;/*set top position otherwise IE overlaps the main navbar*/
	/*display:block;/*sorts out the non-appearance on :hover in IE*/
}
#nav li ul.sub li
{display:block; height:20px; position:static; float:left; width:115px; font-weight:normal;}
#nav li ul.sub li a
{display:block; font-size:15px; height:18px; width:112px; line-height:18px; text-indent:5px; color:#ffffff; text-decoration:none;border:0px solid #E9E9E9;}
#nav li ul.sub li a.fly
{background:#000000 url(images/nav/arrow.gif) 80px 6px no-repeat;}
#nav li ul.sub li a:hover 
{background:#000000; color:#E6E6E6; border-color:#fff;}
#nav li ul.sub li a.fly:hover
{background:#000000 url(images/nav/arrow_over.gif) 80px 6px no-repeat; color:#fff;}

#nav li li:hover ul,
#nav li li:hover li:hover ul,
#nav li li:hover li:hover li:hover ul,
#nav li li:hover li:hover li:hover li:hover ul
{
	left:90px; 
	top:-4px; 
	background: #bbd37e; 
	padding:3px; 
	border:1px solid #5c731e; 
	white-space:nowrap; 
	width:90px; 
	z-index:400; 
	height:auto;
}

#nav ul, 
#nav li ul ul,
#nav li li:hover ul ul,
#nav li li:hover li:hover ul ul,
#nav li li:hover li:hover li:hover ul ul
{
	position:absolute; 
	width:0; 
	height:0; 
	margin:0; 
	padding:0; 
	list-style:none;
}

#nav li ul.sub{
display:none;
}

#nav li:hover ul.sub{
display:block;
}

Open in new window

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Google currently has a new report that is in beta and coming soon to Webmaster Tool accounts. This Micro Tutorial will highlight new features for Google Webmaster Tools.

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question