Home  |  About  | Last |  Submit  |  Contact
AllQuests.com

Previous Question:  Question about Horiz. Center FAQ  CSSNext Question:  Problems with External CSS in IE5  CSS
Question CSS Navigation ( SitePoint Forums CSS )
Updated: 2008-11-23 03:50:03 (9)
CSS Navigation

Hey CSS Gurus!! I'm reasonably sure this topic has been touched on before but I'm obviously not searching with the right keywords.

I'm working with a client on a sports team fan website. One thing that he would like to have is a horizontal navigation row similar to that of SI.com. I have looked at their code and they use a lot of JS and its not very pretty.

I set up some base code using nested unordered lists and have begun to work on the CSS for this. Works fine in Firefox 0.9 and not at all in IE6. Go figure I've dumbed it down a bit (got rid of all the horizontal rules) so you can see what i'm working with.

Hopefully somebody can point me to a tutorial or something to make this work. Thanks for the help guys and gals!!!

HTML Code:
<html>
<head>
	<title>Test Nav</title>
	<style type="text/css">
		ul.nav li ul.subNav
		{
			display: none;
		}
		ul.nav li:hover ul.subNav
		{
			display: block;
		}
	</style>
</head>
<body>
<h1>Test Nav<h1>
<ul class="nav">
	<li><a href="#">Home</a></li>
	<li><a href="#">Forums</a></li>
	<li><a href="#">Recruiting</a></li>
	<li><a href="#">PhotoPost</a></li>
	<li><a href="#">Football</a>
		<ul class="subNav">
			<li><a href="#">Schedule</a></li>
			<li><a href="#">Scores</a></li>
		</ul>
	</li>
	<li><a href="#">Basketball</a>
		<ul class="subNav">
			<li><a href="#">Schedule</a></li>
			<li><a href="#">Scores</a></li>
		</ul>
	</li>
	<li><a href="#">Baseball</a>
		<ul class="subNav">
			<li><a href="#">Schedule</a></li>
			<li><a href="#">Scores</a></li>
		</ul>
	</li>
	<li><a href="#">Other Sports</a></li>
	<li><a href="#">Hall of Fame</a></li>
	<li><a href="#">Site Info</a></li>
	<li><a href="#">Store</a></li>
	<li><a href="#">Article Archives</a></li>
	<li><a href="#">Advertising</a></li>
</ul>
</body>
</html>

Answers: CSS Navigation ( SitePoint Forums CSS )
CSS Navigation

http://www.joelpittet.com/test/simple.php

This code might help your show hide layers quite a bit.

Plus
http://www.alistapart.com/articles/taminglists/

will give you a jumpstart on getting those lists horizontal

you can give me a shout if those don't help you much at joel@joelpittet.com

bind727

CSS Navigation

Listamatic has several examples of nested lists creating a vertical navigation:
http://css.maxdesign.com.au/listamatic2/index.htm

junjun

CSS Navigation

Thanks for the links guys. I will look over them.

Making the list horizontal is not the issue. I can do that just fine. IE6 is not supporting the hover correctly. I think I failed to make that clear in my original post.

ChrisHasenpflug

CSS Navigation

It wont work in IE because IE only understands the hover attribute on the anchor tag.

The New Guy

CSS Navigation

Quote:
Originally Posted by junjun
Listamatic has several examples of nested lists creating a vertical navigation:
http://css.maxdesign.com.au/listamatic2/index.htm
http://css.maxdesign.com.au/listamat...rizontal04.htm is exactly what i'm trying to do. However it too fails in IE6 http://css.maxdesign.com.au/listamat...er-support.htm

Excellant resource however, thank you very much!!

ChrisHasenpflug

CSS Navigation

Quote:
Originally Posted by The New Guy
It wont work in IE because IE only understands the hover attribute on the anchor tag.
So what type of hack or workaround do I have available??

ChrisHasenpflug

CSS Navigation

Stop using li.

Have you seen the css pop-ups example at css/edge (google it)? I've been working on a very similar problem using this method. Basically it alters the display probpery or the span daughter of an anchor on hover like this:

div#links a span {display: none;}

div#links a:hover span {display: block;}

Just like what you have done but without the lists. If you take his example and alter the postion of the displayed span to be next to your anchor you get a very similar effect. The problem is you cannot put anchors IN the displayed span. Or can you? I can't. You migh tbe able to work a way out. An image with an onclick relocation event might work. I'm staying clear of javascript but you could try it.

Subjective Effec

CSS Navigation

Hi,

As ie doesn't support the hover on any element other than anchors then there is no valid way to construct a drop down menu in css alone.

The solution is to use unobtrusive dhtml.

This first one comes recommended by zeldman so it must be good:

http://www.gazingus.org/html/Using_L...TML_Menus.html

and this one is recommended by everyone else.

http://www.alistapart.com/articles/dropdowns/

Between the two you should be able to work out what to do.

Paul

Paul O'B

CSS Navigation

Paul, thank you so very much!!! I used the ALA method and it works great!! I went with ALA over the zeldman method because of my lack of knowledge with DHTML.

Anyways, it works, and I'm happy and my client will be too. Thanks guys!!

ChrisHasenpflug

Previous Question:  Question about Horiz. Center FAQ  SitePoint Forums  CSSNext Question:  Problems with External CSS in IE5  SitePoint Forums  CSS

- Source: CSS Navigation SitePoint Forums CSS
- Previous Question: Question about Horiz. Center FAQ SitePoint Forums CSS
- Next Question: Problems with External CSS in IE5 SitePoint Forums CSS





AllQuests.com