Solved

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

Posted on 2013-06-27
3
483 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
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 26

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

895 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now