Solved

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

Posted on 2013-06-27
3
479 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
Comment Utility
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
Comment Utility
Where, specifically, would you make those changes in the code?
0
 
LVL 26

Accepted Solution

by:
skullnobrains earned 500 total points
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This article offers some helpful and general tips for safe browsing and online shopping. It offers simple and manageable procedures that help to ensure the safety of one's personal information and the security of any devices.
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

772 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