[web-tips > horizontal menu]
A Great CSS Horizontal Drop-Down Menu
The question has been asked numerous times in the css forum, "Is a there way to create a css horizontal drop-down menu in css that will work on most browsers. Well... technically, the short answer is "No" if you are using just css, because IE is problematic in the way it handles css.
However, the above is a DEMO of a horizontal drop-down menu that works:
You see, a smart guy named Peter Nederlof with help from Arnoud Berendsen, Martin Reurings, and Robert Hanson have prepared a brilliant piece of code (csshover.htc) that makes this pretty simple.
So, to make a css horizontal menu work for you, you'll need to:
- 1. Add this css file to your site. In this example, it's in the same directory as this page;
- 2. Add the html code shown below to your web page between the <head> tags;
<style type="text/css" media="screen"> @import url("menuh.css"); </style>
- 3. Add the csshover.htc file to your site. In this example, it's in the same directory as this page;
- 4. Add the html IE sniffer code shown below to your web page between the <head> tags and just before the ending </head> tag. This code has to be the last css loaded. Do not follow it with css that will overwrite these rules. Please realize that the "sniffer code" is nothing more than css rules specifically designed to make IE work correctly.
<!--[if lt IE 7]>
<style type="text/css" media="screen">
#menuh{float:none;}
body{behavior:url(csshover.htc); font-size:100%;}
#menuh ul li{float:left; width: 100%;}
#menuh a{height:1%;font:bold 0.7em/1.4em arial, sans-serif;}
</style>
<![endif]-->
</head>
- 5. If you place the code provided here ALL in the same directory, then you don't have to worry about paths. However, if you wish to move the code to other directories, such as moving the css file to a css folder (i.e., css) then you must provide a path for it, such as changing "menuh.css" to "css/menuh.css";
- 6. Prepare and add your html link code to your web page. An example is shown below. Please insert your text and links as needed.
<div id="menuh-container"> <div id="menuh"> <ul> <li><a href="#" class="top_parent">Item 1</a> <ul> <li><a href="#">Sub 1:1</a></li> <li><a href="#" class="parent">Sub 1:2</a> <ul> <li><a href="#">Sub 1:2:1</a></li> <li><a href="#">Sub 1:2:2</a></li> <li><a href="#">Sub 1:2:3</a></li> <li><a href="#">Sub 1:2:4</a></li> </ul> </li> <li><a href="#">Sub 1:3</a></li> <li><a href="#" class="parent">Sub 1:4</a> <ul> <li><a href="#">Sub 1:4:1</a></li> <li><a href="#">Sub 1:4:2</a></li> <li><a href="#">Sub 1:4:3</a></li> <li><a href="#">Sub 1:4:4</a></li> </ul> </li> <li><a href="#" class="parent">Sub 1:5</a> <ul> <li><a href="#">Sub 1:5:1</a></li> <li><a href="#">Sub 1:5:2</a></li> <li><a href="#">Sub 1:5:3</a></li> <li><a href="#">Sub 1:5:</a></li> <li><a href="#">Sub 1:5:5</a></li> </ul> </li> </ul> </li> </ul> <ul> <li><a href="#" >Item 2</a></li> </ul> ... repeat and alter the list as needed </div> <!-- end the menuh-container div --> </div> <!-- end the menuh div -->
The important things to realize here are:
- The csshover.htc code coupled with the sniffer code makes IE act as it should. If it were not for those pieces of code, IE would just sit there.
- This technique works for all browsers EXCEPT for IE 5.23 and below. These outdated browsers don't even recognize Microsoft's embedded commands.
- The position of the menu is dependant upon the "menu-container" rule in the css document. Change the top and left values and the placement of the menu will adjust accordingly.
-
The class "top-parent" is the main menu item. If you want to include the down-arrow, you may use my gif via this.
-
The class "parent" is the second place menu item. If you want to include the right-arrow, you may use my gif via this.
- The only other things you may want to change are the colors of the menu. In this example, the background is RoyalBlue and the mouse-over state is CornFlowerBlue. As such, the colors are pretty obvious to identify and change.
- While it may be obvious to most, you will need to change the"#" to your links and the text (i.e., Item 1) to what you want.
- Place the csshover.htc and the menuh.css files where your web page can find them. In this example, they are located in the same directory as this page.
- If you have any questions as to how all of this comes together, please take the time to review the source code of this web page. This page works because everything is where it should be. If this doesn't work for you, or if you have problems with this technique, then I suggest that you first take this code "as-is" and move it to your site and get it to work -- it will work if you do it right. Once you get it to work, then make a copy and work with the copy in making your changes. Remember, the code has to be exact even minor changes can make significant differences in performance. So go carefully.
- Also, make sure that the path to the csshover.htc AND the IE sniffer code is correct in your code. Note that ALL of the comments below stating that they are having problems with the menu not working can be traced back to those two simple things not being installed properly. Please check your code thoroughly before posting "This doesn't work."
- For most of you this will not be a problem, but some people have posted problems with my code and asked for my advice. When I investigated, I found that they had purchased a collection of garbage code riddled with non-standard programming and tons of validation errors. Do not report problems here or ask me questions about code that does not validate. Please put your web page through the W3C validation checker before contacting me. If you ask a question and your code does not validate, then expect my public reply to be pointed. So be warned.
- Please Realize that if this menu works for everything except IE, then either the path to the "csshover.htc" is not correct; or the "sniffer code" is not in the header as described; or you have either loaded an external css file or have an embedded css code such that it overwrites the IE code. Please check this before posting "This works for everything except IE."
- And lastly, PLEASE, this is very important. I have taken my time to prepare this technique for you -- it will work if you follow directions. If you find this menu useful then please post your experience to this site. If you want to repay me for my efforts (remember I am usually paid for my advice) then you can pay me something for my time -- $5 would be nice. You can make payment to tedd@sperling.com via the PayPal button below.
Please donate $5 below for my development effort -- thank you.
This technique W3C validates under both HTML 4.01 Strict and CSS guidlines.
Enjoy.
tedd...
Comments
The menu works perfect. I was wondering if it was easy to step the menu out a third level or would I need a black belt in CSS and HTML to achieve this?
As a former Karate instructor, I can say that the secret of most things is paying attention to detail. If you'll inspect how the nested ul tags are arranged, then you'll see how you can expand the method out to whatever menu level you want -- and do so without adding any additional css.
Cheers,
tedd
http://www.rubberducktech.com/build/clients/marineview/index.php#
the csshover.htc is in this directory--->
http://www.rubberducktech.com/build/clients/marineview/
The very first rule is to check your code against a validator -- I forgot to check yours before wading into your code.
Use: http://validator.w3.org/ and check your code.
I suggest that you fix those errors and try again.
tedd
I just set this up on my site and the initial attempt is working fine.
However, I would like to have two of these menus on a single page. When I try to do that as a second set of div's with the item list, the second one shows up as a normal list as opposed to the nice buttons that I want to see.
Any ideas? Note, I am not a css or html expert (though I get by in the latter).
Sandeep
The only problem I see is that my menu uses an ID of "menu-container" and "menuh". You cannot have two identically named ID's on the same web page in css.
So, if you change the second HTML set to "menu-container2" and "menuh2" AND add another css with that change noted, then it will work. Please note that the second css must have all "menu-container" and "menuh" id's changed to "menu-container2" and "menuh2".
tedd
I dunno -- it works for me. I tested it in Safari and IE6 (the problematic one) and it works in both.
Cheers,
tedd
That works fine.
I am quite pleased with myself, that I actually figured it moments before seeing your note.
Just for completeness (and to be sure that I have it right), I also added menuh2 (my second container) to the little bit of code to fix IE compatibility in the head section. I simply replicated the four lines of code changed menuh menuh2 and voila.
Nice bit of code. Thanks much!!
Sandeep
Just wondering what type of magic would be required to get this to work in a vertical fashion? I would like to run two dynamic menus on my site... One along the top for administrative (contact, about, etc) and the other along the side for products.
any help?
thanks,
Dan
So you want the menu to work the same but be vertical? Have you looked at my "Great CSS Vertical Pop-out menu"? It's here:
http://sperling.com/examples/menuv/
tedd
I need a url to look at what you did. It sounds like: 1) your css is not being read; 2) you have too many head tags; 3) And as to where to put the first part and second part, I've been about as clear as I can. The sniffer code goes between your head tags (only two of them are required) and the other goes where ever you want a menu.
tedd
I have the css included into my default css (http://justinandchris.com/Projects/bcmRefresh/includes/default.css) and the .htc file is located at (http://justinandchris.com/Projects/bcmRefresh/includes/csshover.htc)
If you have any more questions for me I will be happy to get back to you and help you.
This menu works for all modern browsers including IE. However, for IE6, the htc code (javascript) is required.
tedd
Thanks,
Ted
No problem, just fill in the href="#" in the "top_parent" to whatever page you want.
tedd
Thanks!
Demian
thanks
Cre8ivemind
The menuh-container div is the container for the main menu. It allows you to control where the menu bar will placed. If you will inspect the source for this page, you will see that I've used this to position the menu bar on this page -- and I've had even said that in the documentation.
So, in your css just place the proper position, top, and left attribute values to put the menu where you want it.
tedd
To prohibit spamming, I do not allow posting of links in my comments, so your link was not included in your post.
In any event, my menu will work with images -- however -- I frown on images that contain words. It's *much* better to use images for background and use text for foreground than it is to try to get that perfect typesetting.
I have a good example of what I am talking about in my "The wonderful world of 'includes' by tedd" -- please review "Web Tips".
There you will find two examples, one without using includes (using images) and one with using includes (without using images) to get the exact same affect. It's well worth the study to investigate this.
tedd
The sniffer code is not the problem. The start and ending declaration tags are what is needed to get IE to recognize the conditional comment while other browsers don't.
Of course, if you change the code I provided, then it won't work. I suggest that you re-read what I provided and be careful with the code. This menu does work for all modern browsers.
tedd
I am using IE v6.0 with SP2. All the files downloaded from this site (css and htc and gif) are in the same directory. What shold I do now. I am a newbie...
All the files are in place as it should be. The sniffer code is also between the head tag. My IE ver is 6. What could be wrong.
I suggest you take my example, exactly as given on this page, and get it to work on your site. After that, then you can alter it to your liking. Understand, if my example on his page works for your browser, then it should also work on your site. The only reasons for failure are not following directions and/or paying attention to detail. For example, when you were asked to provide the url for your web site in registering for making comment, you provided the url for this page instead. That's not paying attention nor following directions.
tedd
Thanks alot for your reply.
I have copies the html file at the link below. I am using the css and htc files provided by you so i did not copy.
http://drive.123-reg.co.uk/F/8137715-301732905
It works on the most recent versions of FireFox and all modern browsers. What are you using?
tedd
If you do not have a web site, then how can you say it's not working?
Please provide a web site showing the code not working. Do not expect me to look through all your files to find your bugs. Understand I'm trying to help, but that does not included debugging your code.
tedd
Please send me solution for this.
Thanks & Regards
Arti
I have used the code and it has worked fine in IE6, Maxthon (One of latest versions) and Firefox (latest version).
The code worked perfectly in IE6 and Maxthon, however in Firefox it only shows the top_parent and parent levels of the menu but not the sub lists from those.
Any advice would be appreciated.
Sadly I can not show you a working website as I am using your method to develop a resource website for a department at the school that I work at and it is not going to have a web address of its own. It is going to be part of a VLE.
Gaz
I've been playing with your lovely menu bar and it will display beautifully by itself [menuh-test.html], but if I put that *exact* same HTML and CSS into the rest of my page [index.php], only the last two top-family menu items act like links.
I'm sure it's something really dumb, but I've been looking at it forever and can't find it.
Thanks so much for your help!
Peg
Thanks..
This menu works for all new versions of FireFox under Windows 2000 Professional, Windows Vista, and Windows XP as well as all other modern browsers. The menu has been thoroughly tested.
However, I do not know under what conditions your VLE is being run. Does it have javascript turned OFF, if so then the menu won't work because the htc file is javascript. Try checking that.
tedd
I haven't a clue as to what went wrong. I would need to see the page that is failing. Please provide the url in the form of "sperling.com/test/" (IOW, no http).
I can say this, this menu only works when it is assembled properly and all the files and code are exactly where they should be. While this is simple, it is not an easy undertaking.
tedd
No offense, I am not here to provide you with solutions. If you have problems with Flash or other such coding, then figure it out like the rest of us -- or -- hire me.
With that said, look into the zoom levels for this menu and your Flash.
tedd
I'm sorry about that!
The page with just the menu and style sheet is norcalheal.cnr.berkeley.edu/menuh-test.html . The menu on this page works beautifully, as advertised. :-]
The page with the rest of my page contents is
norcalheal.crn.berkeley.edu/index.php . This page contains the exact same code and style sheet as "test," but for some reason only the last two links in the menu work.
I'm simply flommoxed....
Thanks so much!!
Peg
Thanks again!
Peg
You're absolutely right. One of these days I plan on addressing that -- it's a hover-on-text instead of hover-on-background issue. However, it's a minor problem and most people live with it without much trouble. When I upgrade the menu, that's one of the things I'll fix.
tedd
Excellent question. However, it requires extra work and understanding what's going on.
The only way for the menu to highlight what page the user is on is for the menu to know what page is current. There are several ways of doing this (i.e., use of body tag, use of active attribute, etc.). But the one I like is to allow a php script running on the server to identify the current page and change the menu accordingly. I think it's pretty simple, but I've had people who simply could not get their head around it.
In any event, you can see an example of this via my "Wonderful World of Includes" web tip, namely:
http://sperling.com /examples/include-demo/after
If you will note, the menu stays highlighted for the current page.
All the code is there ("Wonderful World of Includes") -- all you need to do is figure out how it works and apply it to your project.
tedd
This is a very cool code, I have written a php file to write the list code, and the css is an exact copy of yours, the menu operates perfectly (when you hover the mouse over the 'top_parent' the items drop down etc..) only problem is the top parents are stacked vertically and when the menu items drop down, they hide the top parents below them, obviously this is a problem, seeing as how it is supposed to be a horizontal menu; any suggestions would be helpful, I've been recoding the css for a few hours and haven't made any headway...
thanks a ton
I've tried this on my site and it works great on Safari & Firefox but not on IE. This is a pretty strict CMS so I can't add anything to the head of the site so it's in the body. Does that make a difference?
http://www.ihop.org/Publisher/Article.aspx?ID=1000042314#
Thanks,
Geds
Thanks -- I need to see an example of the problem. Please provide the url such as "sperling.com" -- and I'll have a look at it.
tedd
Yes, it does make a difference. As mentioned in the description above, there is sniffer code that is required to make IE's behave. Without it, IE resorts to the typical M$ mentality -- which is to do something other than what other browsers do because M$ may find profit in causing difficulty between OS's (my opinion).
tedd
I apologize for the inconvenience but as of now I am only running the web page locally, and I am unsure as to when I will have the web space made available to me. Any suggestion would be helpful and greatly appreciated
tedd
Many thanks,
Charles
The most common reason why it won't work for IE is that you still don't have the paths correct. If the browser cannot find the files, then it won't load them and thus you'll have the problem described. Please check again.
tedd
Thanks for making this code available - it was exactly what I was looking for!
Wonder if you could help me with a change, though. I want to use the menus to set form parameters rather than as links. I have it working except that the menu stays open after being clicked (it closes on mouseout, of course). I tried setting the parent's display style to "none", which works, but prevents the menu from re-appearing when it is clicked again.
Thanks again,
Joe
The menu fulfills a specific purpose. Using it for other things may not be the best way to go. It might be better for you to look at html selection drop-downs. Search Google using "html selection drop-downs" -- here's an example.
tedd
Thank you for this code. I had the same problem as Sophie (and Shahid) ie the menus displays OK in Firefox, Opera, Safari but not IE6. However this only occurs when testing on local computer. When I upload to website the code displays as it should in IE6. (javascript problem on local computer?) Maybe Sophie is testing locally and hasn't tried uploading it yet.
Tedd, I don't want my boxes all the same size. (You have them set in your '#menuh ul' with the width parameter). I want them to expand relative to menu text length in the top menu (and to the maximum text length in each sub menu). Is this possible? And if so, what do I change to do this. I've tried a few things but end up messing everything!!
Your "tedd's slide show". on webbytedd site - do you show the code for this anywhere please?
Thanks
Pamela
It worked in all browsers! Thank you so much...I've been trying to get a drop down to working in all browsers for 32 hours straight...my client was about to kill me. Thank you so much!
How do I change the width of the drop down only? I like the width of the parent but need to make the subs expand automatically.
Thanks!
1. No matter where you have the code (web or local), it should work. When the code doesn't work, the problem almost always goes back to the paths not being correct. Remember, you only need the javascript "csshover" code to get the IE's to work like other browsers. This code will work with all other browsers without javascript even being turned on. That's just the price we all pay for the majority believing M$ is the solution to their computing needs.
2. If you want expandable menu boxes, then don't set a width for them -- just leave them alone (i.e., take the width out) and you'll find that they will adjust.
3. As for "tedd's slide show" on my webbytedd.com site, the code is actually there. To make it simple for you to use, get FireFox; go to my webbytedd.com site; view the source to get the html; view the javascript to get the javascript. Take that code along with your pictures (at this point name them a.jpg, b.jpg, and so on) and put it on your site. That should work after you change the url to match yours.
If you can wait a bit, I'll have a write up on this site soon -- I have a couple of other things at the moment to finish.
tedd
Help please!
Re first post (parent static but children adjustable)
As it is now, you have a choice of fixed-width or variable-width, but not both. I know it can be done, but I don't want to wade into those waters.
Re second post (i.e., "Help it's not working -- the client sees only the menu bar").
I will bet that your client is using IE. As such, it is the age old problem of paths being correct. If you make the paths right, then this will work. For proof, have your client look at this page. I'll bet it works for her. So, review and fix your links.
tedd
I have started putting a new website together and have put the a test version of it at the address entered into 'your web site'.
The site will not stay there when complete.
The menu system you have given us has been used and it works wonderfully under Firefox but gets the widths if the buttons wrong under IE7 (no idea about IE6),and wraps the menu so that the last button appears under the first one and is unselectable.
Any ideas?
I have checked the CSS and the HTML using the validation services and they have been VERY useful in correcting sloppy code and cross browser problems. However, I cannot see the fault with the current problem.
Regards
Chris
The only reason why it would wrap is that you have not provided enough room for the menu. I have clients all the time who want to put three yards of text into a two inch spot. All I can say is reduce the length of the text and try that.
tedd
I have tried viewing the test site mentioned with another PC also using IE7 and it formats the button width correctly.... weird.
The trouble with this PC is that when the menu 'drops down' the buttons below are transparent and are difficult to see against the webpage content.
The css file and the csshover.htc are all in the same directory as the the html and the sniffer code is in the header.
Regards
Chris.
The only reason the menus would be transparent is if you made them that way -- check your css rules.
tedd
first off thanks a bunch for this :) helped alot. Spent numerous hours tryin to find one simple, and effective and this is it. 10/10 for that!
Ive hit a slight problem that ive noticed a few people have had, this is that the menu works within over browsers apart from IE. (ive only tested mine in IE7)
Here is the link to the page: http://www.merovingian-guild.co.uk/website/index.html
and this is a screenshot of the directory:
http://www.merovingian-guild.co.uk/website/help.jpg
This may help solve a problem alot of us are having. Probably something uve already metnioned and we have overlooked something.
Another problem ive got, is that as ive only started to learn CSS (im talkin like a couple of days) im not quite sure how to get rid of the left border for 'Home' but keep it for the others.
Any help is much appreciated. :)
Thanks
Josh
This was a hard one to find. Believe it or not, everything works. Your pagestye.css is causing problems. When I took that out, the menu worked.
You need to learn css.
tedd
Thanks for the info. I am having an issue with the flyouts falling behind an embedded video. I saw the z-index numbers in the CSS file and played around with those a bit (specifically making them negative), to no avail. Any suggestions?
This is extremely beginning stages but I need this portion to work before proceeding:
http://www.umsl.edu/~webdev/transfer_orientation/sperling-test.html
Thanks in advance.
Holli
As I understand things, which may be in error, the problem comes about because the Video is being kept in the foreground while the menus are placed behind.
I suggest that you give the menu a z-index greater than that of the video. That means of course, that you place the video within a div that has a z-index less than the menu's z-index. In other words, give the menu a z-index of 1000 while giving the div that contains the video a z-index of 1.
See if that works.
tedd
I will let you know if I figure anything out. Again, I really appreciate your response and suggestions.
Best,
Holli
Thanks for looking into my questions and I have found the problem with IE7 width is due to a 'Font Size' option in the Tools menu being set to Medium... if it is set to Smaller or Smallest then the menu width formats OK.
I think I gave an incorrect description of my other problem however and the buttons are not so much transparent as appearing to have dropped down behind the image below instead of on-top of it.
This only happens in IE7 not Firefox... any idea?
A test of the website is at http://www.classicglory.com/test/index.htm
Thanks in advance.
Chris.
I read your answer to Holli above and used the same principle on my menu. It now all displays perfectly.
Sorry to have taken your time and thanks for the code.
Regards
Chris.
Finally figured out that that I had to use a doc-type at the top of the page, like
Once I did this everything worked great. Hope this helps others who may be having a problem.
Is there any way to keep DIV elements from overlapping?
For instance, your code works great, but I'm having severe difficulty getting it to go where I want to on the page. The menu ends up invading and overlapping another DIV element (like a quotebox). It's driving me absolutely nuts.
- John
That's a little bit like saying "How do I keep my dogs in my back yard now that I'm using your fence?"
You use it like it's meant to be used. It does not have nor require any gapping holes nor overlapping DIV's. The first DIV, namely menuh-container, is the DIV that contains the menu (see important thing 3 above). You can move that DIV anywhere you want. It's just that you need to know how to position that DIV on your page and that is more of a css thing than having anything to do with my menu. You need to understand how css works.
Cheers,
tedd
Thanks for providing this CSS!
Everything that is shown on a web page can be governed by css. If you encapsulate (enclosed) an element within a div and provide a css z-index value, you can stack elements on top of one another and choose which one is on top. Check out css.
tedd
I just wanted to thank you and to praise you... You are a CSS and HTML guru :) for real.
I use HTMLPad and can instantly view the result for IE7 and FF and had the menus lined up with FF but IE7 had the menus offset 2" to the right and didn't know how to fix it for IE7. Your code worked instantly and correctly for both browsers so I can sleep easy tonight.
Just one small mystery. I pasted in the sniffer code as ordered but it is all greyed out. Not for me to mess with it but I deleted it and everything still worked so I just put it back as insurance against murphy's law.
I havent used it on the web site yet but will soon. Many thanks.
The "sniffer code" is only there for IE6 -- it's just one of those things that we all have to live with because M$ doesn't have to play by the same rules as everyone does.
The code is "greyed out" because it is located within a commented-out section of html code. Normally a commented out section of code simple means that browsers should not consider it. It's a place for us programmers to add our documentation (i.e., notes to ourselves). Fortunately, unfortunately (depending upon how you look at it) IE6 considers comments. This is just another example of not playing by the rules -- but this time we can use it to our advantage and get that horrible browser to do something that all other browsers can do without problem.
I think we would be further along on the technology highway if we didn't have M$ building speed bumps.
tedd
-John
Thank you for for taking the time to put something together that is so clean and so well documented. Outstanding work and I appreciate it immensely.
I have tried very hard to follw through your instructions.
I have it working in my page (you can see it at the URL I provided with this coment). What I haven't been able to figure out is how to position the menu properly within my table. Or will it not work properly in a table? I've tried, but found it a bit of a challenge, to recreate my site entirely in CSS and DIVs, so for now I'm stuck with tables. I think you'll be able to see from the source code when I want it to be. It's just not going there. If you can help, I appreciate it.
~N
I've been a little busy lately, so I'll answer the last five posters here.
John: The parts you need to change the background portions on the menu are all within the css. Try adding a border around different rules until you understand what rule applies to what object. Then alter as you like.
JR Peck: You are welcome.
Azee: One of the things that often brothers me about clients is they want too many characters in menus. I keep saying, you can't put 100 characters in something that is only 60 character wide. IE6 is a big problem and will remain so until people switch to something else. Until such time, we all have to live with M$'s mistakes.
Bill: Without a URL, I can't say. But I can say that FireFox usually doesn't have any problems with good code -- check and recheck your code.
Nebulous: The problem you describe is typical of layouts that depend upon tables -- don't use tables. Figure out how to layout your pages using css and leave tables for only displaying data.
tedd
then the menu does not work then!
What you are talking about are two completely different things.
My menu will work with any character set you can provide -- it's just text. HOW the text is shown in your browser is a different matter. Using the Russian Cyrillic Alphabet means that you have to set up your page to show that charset. Try using within the head tags and then use whatever characters you want.
Here's one reference: http://www.joelonsoftware.com/articles/Unicode.html
Here's another: http://www.alanwood.net/unicode/
tedd
That's a css problem, not a problem with the menu. Learn css.
Cheers,
tedd
Nonsense. Transparent is the same as any other color except you can't see it but rather see the background behind it. It has no functional aspect with the working of the menu.
tedd
http://www.thesoundsmith.com/private/a_MENUtest.htm
The menu works great in FF, but in IE, the dropdowns are behind the other elements. I have added z-indexes to no avail (I had this same problem on my earlier pre-CSS design as well, the only solution I could find was to reduce the number of menu list items so they don't extend so far down the page:
http://www.thesoundsmith.com/private/cofallico.htm
is the same page in production...
Any idea ow to get z-index to work? IE even places the headlines over some items...
I'm sorry that you did not receive a reply from me in a timely manner -- I was busy attending to paying customers. I am often taken back by people's assumptions that because I offer free advice that I should be quick about it! As my mother used to say "No good deed ever goes unpunished".
In any event, I've reviewed your code and see that while you scattered z-indexes about my menu, I don't see where you assigned z-indexs to the other elements on your page. If I had this problem, I would look there.
tedd
I've recently starting to work with this code and it works great (thanks for it by the way!) on firefox, but there is a little problem on Internet Explorer... I see the dropdown menus out of place and i dont know how to fix it on the CSS. They are not appearing down the top menu, they are moved to the right, which makes it hard to reach with the mouse.
Here's the link:
http://www.fpb-designs.com/asm
Thanks
Kiko
I implemented the menu into my site, keysundaycinemaclub.com, and it looks and works great in FireFox and Safari. However, when I test it in IE 6 and 7, it appears to work fine everywhere except the 2nd list item drop down ("CITIES"). It drops down properly, but as I mouse over the 3rd item down on the drop down, the drop down just disappears.
First, I checked and re-checked all of my code against yours. Second, I attempted to tweak my CSS and HTML. Third, I double checked that the IE sniffer code and the csshover file were properly placed. None of that solved this issue.
Thank you in advance for any thoughts you can offer.
I am hoping this is a simple question. I am learning css for a school project and I have encountered an issue with the horizontal drop down. I know it must be related somehow to my stylesheet but I don't know where to start. I have your menu displaying just fine in Firefox however my second button dropdown is disappearing on me when I mouse over. Any ideas? What can I provide that would help?
Thanks in advance.
I've reviewed your site and you need to understand more as to how css works. You have placed embedded css rules after the IE sniffer code which overrides it. Figure out how to place all your rules in the external style sheet and don't use embedded css.
Cheers,
tedd
In any project, school or not, you must first understand how things work to get the job done. The best way here is to use my code exactly as it is written and get it to work on your site. Remember, there is no reason whatsoever why it should not work on your site IF you have copied everything exactly.
After you do that, then make a copy and start changing the copy to see how those changes affect things. There is no substitute for hard work and at least in this project, you know it will work if you follow directions.
tedd
Like it appears Brad has done, I too have exhausted precise copying and pasting, close scrutinizing, and checking/double checking BEFORE even coming to you, Tedd, for possible advice.
So again, any help you could provide would be much appreciated. I thank you again in advance.
Okay, both of you say everything works except for IE -- that should give you a clue as to the problem. Somehow IE is not seeing the "sniffer code". The "sniffer code" is nothing more than a set of css rules specifically designed for IE.
Walt, I looked at your site and I see the problem. In all my directions I say "Take my example exactly "as is" and put it on your site and get it to work before you alter it" -- but you didn't do that.
The problem with your site is that while you load in the "sniffer code" to make IE's work correctly, you then load other css which over writes the rules. IE is simply following the instructions you provided.
Please read the directions I posted and follow them.
tedd
I think I worked through my issue with the menu disappearing. Onto my next problem. What is the cause of the activex security popup everytime I load the page? It's possible that it's occuring because I am testing the pages locally instead of a webserver but I would like your input.
Thanks.
I am truly sorry for doubting the master! You're right, I did not follow your instructions to a T when I thought I had. I moved the IE sniffer code to follow my other CSS references and now it works perfectly. I was sure it was an issue with my CSS or HTML; but I never thought about the order of my CSS (even though it's pretty explicit in your instructions). Thank you for your help, and again, thanks for an awesome code.
Rock on-
Walt
Thanks so much for posting such a wonderful script!
I do have a small problem and would be very grateful if you could help me solve it. In "#menuh ul" I commented out "width:9em;" I then added some padding to the "#menuh a".
All of this works well in all browsers including IE7 with an exception of IE6. In IE6 all the menus are listed vertically instead of horizontally. Could you help me?
Many thanks!
Yes, I could help you, but I can't unless I see the code -- and this is what I do for a living, if you get my drift.
The problem here is one of reaching critical mass -- everything was fine until you added padding and now IE6 doesn't like it. Welcome to the world of browsers.
All of this is a balancing act -- make a small change and look at it in a half a dozen browsers. Then change it more, or less, and look at it again. Keep trying until you have a solution you can live with. That's one way to find a solution.
Another way is to use a hack -- in other words, use a css rule in a special way to make one browser see something differently than another browser.
Pick out a IE6 hack and restore the padding to what it expects.
Good luck.
tedd
tedd
The menu works great. Thx!
I still have one problem: when building more than 3 levels, all the content comes on the screen at once, without having to go over the lower menus with the mouse.
I made an example at menu.vbop.be/index.html
When I go over 'Personeel', still OK, when I go over 'Participatie', still OK, but when I go over OCSG then it all pops out at once.
Does the menuv.css file need editing? I am not that technical but willing to try. If 'yes' Do I need to add ul ul li blocks or something like that?
Thank you in advance
Wim Verhaeghe
What a great suite of code! I'm having a similar problem as Evan and blue: my top menus are stacked vertically and the children pop up vertically (well, that is the correct behaviour for the children) obscuring the menus underneath them. Any suggestions as to what I'm doing incorrectly? Since there have been a few of us experiencing this, perhaps you can post where we are going astray.
Cheers,
Andrew
When you build a menu that complex, it really takes an effort to make sure that your tags are in the proper order and closed properly. Also, please validate your code through the W3C validator, like so:
http://validator.w3.org/check?uri=
That will do a lot to help you with all your coding.
tedd
Fair enough. Page validated (and errors caught...thanks for the pointer), but the behaviour of your menu has not changed any. Any suggestions?
Cheers,
Andrew
You're tutorials and advice are all great. I have a IE problem with the vertical css drop down menus. I am not sure where I went wrong, it works well in both firefox and Safari but in IE the drop down menus (on Hover) do not get initiated. Any help is appreciate. Keep up the good work.
Read the documentation.
tedd
Thank you for your site and the service you are providing with this code.
I have used it in my site and everything is working great on all browsers except for one thing ... my top level menu items display in vertical configuration in IE6. I got the top menu to display horizontally in IE 5 and used pages with links to substitute for the missing drop downs.
I just cannot figure out how to make the IE menu to display horizontally. The submenus and hovers all work and display properly.
Is there a simple solution that I am missing?
1. IE 5 is ancient history and the worst browser ever! Fortunately, web Statistics show it's market share is less than 1 percent -- so, why consider it?
1. As for other IE's please read what I have posted above. All the answers you need are in the documentation I posted.
tedd
This is a very good menu. Works fine in Firefox, Safari, IE7 & IE6, and it even works fine in your favorite browser IE5 (we have IE5 users visiting some web sites).
The dropdown doesn't work in 5, but by linking the top parent to a page with links to the submenu pages, the site is usable.
Thank you, Tedd.
#nav ul ul{margin:-1em 0 0 -6.2em;}
Does my menu on my site work for IE7 when you view it? If so, then this menu works for IE7. To get it to work right for you, you need to repeat what I've done here on your site. Once you have it working, then you can alter it as you want, but you need to get it working first. Remember, there is no reason whatsoever why this menu will not work for you other than you are not following the directions posted here.
tedd
If you installed the menu correctly, it will move with the browser window. However, it does have a minimum size where it will not wrap and hold the page to that size.
Without seeing the url, I can't tell you more than that.
tedd
So, here's what I'll do -- you pay me up-front for my time and I'll look at your site. If I find the problem is that you didn't follow directions, then I'll keep the payment and tell you want to do to fix it.
If, on the other hand, you have found something that I overlooked and the problem wasn't you following instructions, then I refund your money. If that is acceptable to you, then make payment of $50 to tedd@sperling.com via PayPal.
tedd
That should not happen unless the id's and classes are the same.
You must understand css to use css. The addition of another style sheet will NOT do anything to the existing style sheet unless there are conflicting id's and classes. If so, then change them to something else. That's elementary css.
tedd
-Joe
Please don't take this the wrong way, but you can't find the time to investigate something that is being offered for free -- yet you want me to spend my time to do your research for you -- is that it?
I've taken my time to put up this example that will work PROVIDED that you take your time to read what I've posted. It's that plain and simple. If you want to hire me to make it work on your site, then I am open to that as well. My minimum charge is one hour of my time at $50.
When I receive $50 from you via tedd@sperling at PayPal, then I'll drop what I am doing and research this for you. Otherwise, please take the time to read what I've posted.
tedd
thank you very much for your work tedd, your code rox !
For those who have a display problem in IE7, check your doctype tag at the begginning of your HTML page...
I nearly got mad because the menu was working with Fx 3 but not with IE 7. I finally found the explanation : my HTML editor put a "HTML 4.01 Transitional" doctype tag by default, if you remove the transitional it works perfectly... To be sure just copy the doctype used for this page.
Maybe you should put a note about that in your tutorial.
See you around.
Thank you.
Your page can not access the style sheet. See here:
http://sean.xancomp.com/gateway/menuh.css
When you can fix that, it should work.
Cheers,
tedd
Thanks so much for your help. The CSS code provided is really clean and easy to figure out. One question though... I deleted the width for #menuh ul and added a small left and right padding to #menh a. This works fine in Firefox, Safari and Chrome but not in IE. God I hate IE. LOL.
Thanks people!
Thanks for the nice script.
Great stuff, thanks! May I suggest that you add to your 'Important things to realise' section that if it's working in Firefox and not in IE that DOCTYPE might be the reason.
Best Wishes
Colin
Thanks for the piece of code. I just have one concern, that is that the text in the menu columns is spilling out. I don't want to extend the boxes so that some hang out. I just want the text to "return" to the line below so it only increases the height of the box.
Thanks,
Cam
I have created a new index file for our website, but am running into a couple issues. (I have not had to time to go through all posts and there is probably some that would help my problem.) So to get down to it, I will ask.
How can I get the menu to handle different screen resolutions? It looks fine under 1024x768, but 800x600 the menus get cut-off.
Also, because I want to use the menus as part of the main index.htm file, I want to place the district logo above and some pictures below. I was able to get it done by placing a table above and below, but it acts kind of funky. The only way I could get the pictures at the bottom to be spaced away from the menu was to put some blank cells at the top of the table, but I know there is a better way.
If you could peruse my page and give some feed back, I would appreciate it. (http://www.santaritaschools.org/newindex2.htm)
Thank you
Great example menu thank you very much but may I ask?
I have applied a current class so that the current page (parent dropdown)is highlighted BUT it is knocking the drop downs below out? Can you help me please?
Thanks for the great code! It works great for me, but I'd like to have the dropdown menu type a little smaller than the main menu. Is there a way to do that? I've tried messing with the CSS, but can't figure out which style to change, or if I this is even possible. My practice menu is available here:
http://firelilyphotography.com/practice/home.php#
and what I'd like it to look like (but work in IE and Safari without the ?? boxes), is here:
http://www.firelilyphotography.com/clarkstreet
Thanks so much for your help!
~Jen
Of course I just had to bother you with a post, and then I was able to figure it out! Thanks again for the awesome tutorial!
~Jen
Try this -- set the font size to what you want the drop down menu items to be in menuh (i.e., font-size: 12px) and then add another rule (i.e., font-size: 16px) to make the top_parent class to have a larger font.
However, I have not checked this out with all browsers.
tedd
First of all, THANK YOU! I am a complete amateur and have about 2 days experience using CSS. I followed your directions and the menu of my website (currently awaiting upload) works perfectly in all browsers.
Question: Is there a way to be able to take the html of the menu and put it in an external css file? This way, changes for all pages' menus could be made in one place.
Thanks again!
Amber
Look no further than this:
http://sperling.com/exampl es/include-demo
While technically you are not taking the html and placing it in a css file, you have the general concept right. The above link, if followed, will give you a leg up on all other web developers that have not discovered how to use includes. Like I say in the write-up, this will change the way you program for the rest of your life -- it's that important.
Good luck,
tedd
What you are looking for is called "image replacement". There are some examples at webbytedd.com -- that's one of my web development sites.
I do know that it is complicated trying to incorporate image replacement within this drop-down menu -- it's difficult. I strongly suggest that you study this example: include demo before attempting it. That demo will show you why you shouldn't.
Cheers,
tedd
Ted said, "Terry: You're absolutely right. One of these days I plan on addressing that -- it's a hover-on-text instead of hover-on-background issue. However, it's a minor problem and most people live with it without much trouble. When I upgrade the menu, that's one of the things I'll fix."
tedd
---------------------------------------------------------
Hello, tedd
I am having that very problem, but in my case it's a big deal because it interferes with the style I want (different color text on hover and a horizontal second tier). It seems like it would be a big deal either way, but I'm just wondering if you ever got around to fixing that. If not, maybe you could just point me in the right direction? It's actually working great in IE8 and Opera9, but not in FF3 or Safari3. Why is it that your example above doesn't have this problem?
i figured it out--it was simply a matter of margins and padding around my second level list--don't know why i had those in there, but it was quite a riddle for a whole day--i'm glad i figured it out before you could waste your time looking at my code.
Thanks for the free code. It's excellent! Son of Suckerfish simply WOULD NOT BEND to my wishes, but your code saved my weekend. I've spent waaay too much time on that nav bar, if you know what I mean. Thanks again, and I will definitely be back for more stuff!
I found this menu very simple and straightforward. However, the dropdown part doesn\'t work in IE7, even with the correction inserted just before tag.
Here\'s my link, a site running WP 2.8 (http://www.lagazzaladrabijoux.com/)
Firefox, Chrome, Opera, Safari displays it perfectly. Only the buggy IE has problems.
Last thing: the top_parent doesn\'t keep the hover state (I mean, inverted background and text color) if I point mouse over a child. Is it normal?
My submenus get hidden depending on the size of the browser window on the right side. Is there any way around this?
http://test.angusJournal.com/library
Great menu. Used in a couple of different sites, by the way.
First of all, I'd like to thank you for sharing such a nice tutorial (written in plain-English) and answering questions.
I do feel rather dense on one issue though and I know it's an error on my part. My menu runs vertically as opposed to horizontally on both IE8 and FireFox and I'm at a loss as to why. I have read through the tutorial several times, have validated my code, have all the files in one directory and copied the sniffer from others' working sites. I do hate to be a bother, but if you could perhaps tell me what aspect of the code makes the ul-list run horizontally, then at least I'd know where to aim my troubleshooting? Or if anyone else on here has had the problem and fixed it, I'd be most grateful to hear your suggestions.
Thank you kindly,
Klara
Nonsense.
I just tried it in IE 7 and it works for me as well as every other poster here since IE 7 came out.
tedd
I'm not going to be answering questions on this menu since I rewrote it. Please look to my new drop-down menu here.
Cheers,
tedd
#menuh a.drop
{
background-color:#8CB094;
color: #2D5C3D;
width:150px;
}
#menuh a.drop:hover
{
background-color:#C7DCC9;
color: #2D5C3D;
}
I added those to the bottom and then set the class to each individual box in the drop menu to "drop". You can even copy and paste it again into your css file and rename it to control the width/bg colors of two drop downs seperately. Once you have that in your css just set the class of the link to "drop" like so:
Link
I am not that good at describing this but if you have width issues in explorer I am willing to help. Just email me at xylude@gmail.com and I will do my best :)
As with all things, you can add additional functionality with additional code. Change as you may.
As for the menu widths being different sizes in IE, if you comment out the width declaration, that's just the way IE works -- some people want it to work that way.
Cheers,
tedd
Still, this menuh has a big drawback : ACCESSIBILITY. I tried to adapt it for keyboard-only users and found a weird problem (valid html & css, in ff 3.0.11 linux and ie8, safari, opera, ff3 & chrome in win xp sp2).
I added the :focus pseudo-thingie at the end of the css (my menu has only one level):
#menuh li:hover ul ul, #menuh li:focus ul ul
{ display: none; }
#menuh li:hover ul, #menuh li:focus ul
{ display: block; }
I also added :focus wherever needed (wherever there's a :hover). With the tab key, each of the top links "activates" normally and is clickable (with enter, even js), but the menu doesn't drop-down below... The mouse works perfectely on all platforms, but all these browsers return the same behavior with the keyboard.
Did I miss something ? Any clue ?
Thanks in advance, cheers!
ps : I just saw there's a new version, which apparently has the same flaw...
I would like the menu to be put where I put it. Making it 'relative' on 'menuh-container' instead of 'absolute' causes it to do so in vertical. However it won't behave like that in horizontal since it is still stuck to the left but should be centered.
I can specify the left attribute like you suggest but in this way it will still look differently for different resolutions.
I want to center the content of my site both in vertical and horizontal. Would you say that it is possible to do so with this solution so that it looks pretty much the same independent on which resolution you are using?
Thanks / Niklas
If you will read my post on June 24, you will see that I am no longer answering questions regarding this menu. I have provided a newer and better menu -- see web tips.
Thank you,
tedd
In my scenario top_parent elements have less width than sub elements so I made a litte modification and I want to share it who has same issue;
in css file;
||add new||
#menuh ul.root, #menuh ul.root:hover
{
width: 150px;
}
||find and set width attribute which applies to subitems||
#menuh ul
{
list-style: none;
margin: 0;
padding: 0;
float: left;
width: 300px;
}
/*sample*/
ShortText
very long sub item text1
Sub 2
Products
Product 1
Product 2
Exactly what I was looking for...a simple drop-down menu without anything crazy or with a big footprint like javascript and flash. And must work on the majority of browsers.
You sir, are awesome at life.
Cheers.
As so many other people have written, I have problems with the page, I've done, when it comes to seeing it in IE.
I'm guessing, your reply will be, that I should look at my CSS or my paths, but I've been doing that, and trying different things without luck. My munuh.css file is inside a folder called _css, and the csshover.htc file is in the main root folder. I placed the sniffer code, as you described, but it doesn't work. Hope, you can help me.
I'm not sure what you are asking. The only installation here is simply to upload the files to your website. After you get the files working, then change them as you want. Wordpress doesn't have anything to do with this.
Cheers,
tedd
I don't know, I don't use Wordpress. I say upload my files to your web site and use them as I have directed. If you can do that and also use Wordpress, then that's great. But I offer no advice as to how to incorporate my drop-down menus in an application I don't use. It could be simple or difficult -- I don't know. If you have a question about the menu I offer, then I'll answer that as best as I can, but how to use it in another application I can't comment.
Cheers,
tedd
These are a css problems and not a problem with the menu. Please learn css.
Cheers,
tedd
Any suggestions?
1. If you're going to work on the web doing web sites, learn css.
2. My menu works with good code, so validate,
tedd
Yes, it is possible.
Here's an example that I did:
http://sperling.com/clients/beckyscan/services-gifts.php
Note that both menus retain their page position.
To do this, try using this:
http://sperling.com/examples/smart-menu/
Cheers,
tedd
While this may be obvious, please review your code -- you have done something wrong.
Cheers,
tedd
Please post a sniffer code compatible for all browsers.
e.g. IE 6, IE 7, Google Chrome, Firefox etc.
Regards,
hrishikesh
A sniffer code?
Sure, if I wanted to step back to circa 2000 -- that's a poor solution. The solution is to learn css and how to use it.
You might want sniffer code for the assortment of hand-held devices out there because many of those are not compliant. But there's no need for sniffer code for today's browsers.
tedd
Thanks for your previous reply.
I used your code. I am using horizontal menu bar.
But i am not getting dropdown menus to the parent menus.
When i go through csshover.htc file in my application the visual studio is showing errors to the code.
g
Is it like this way?
Please guide
hrishikesh
I cannot tell you more than what I have said in the documentation.
Please read it.
Cheers,
tedd
Yuko
I managed to fix the problem.
I added
#menuh ul {width: 109px;}
in your sniffer code
Yuko
What you propose is NOT a "fix". It is just something that makes your version work the way you want it for your browser/os combination. You will probably find that your fix is not universal and others wills see your work differently.
As I explained to you privately, I suggested that you use a center alignment for your menu, but you chose a different route and now you posted your "solution" as if it's a fix -- it is not a FIX.
Good luck,
tedd
The only thing is that the White Arrows dont appear, any suggestion or possible reasons.
It's clear that you didn't read the documentation.
The arrows are provided in the documentation with the following link:
http://sperling.com/examples/menuh/arrows.php
You must understand that I take my time to place all the documentation you need on my site, I give you instructions as to how to use it, and I still have people failing to read telling me that I forgot something. Sometimes I think it's not worth the effort to try to help others.
tedd
First, we all appreciate your time. Just a few bad apples can leave a bad taste, unless you let it ferment then you can have a happy day! :)
The code works for both IE and Firefox and displays the top bar, however, the dropdowns appear to be working however are not rendering fully. I had thought it was the images in the css, so set them to background but that did not solve the problem
Can you please assist with this problem?
Thanks,
Beth
What problem? You have not even identified the problem you are experiencing. In addition, is my menu on my site here working in IE and FireFox? If so, then the process works and the problem you are having is that you simply have not followed directions.
Ask yourself this, why is it that over one thousand people have installed this menu without any problems and you are having difficulty? Could it be that you missed something that is obvious to others?
Please re-read the directions and follow them exactly. If you have followed my directions exactly, then show me where you installed my menu "as-is" on your site and we'll proceed from there.
tedd
I thought I had identified the problem - sorry. As indicated, I have the menu working but the drop downs are not displaying because of the css. If you visit the site, you will see the situation. In Firefox AND IE the menu does appear and the drop downs DO work if I set the font to small, but only some of the dropdowns are displayed. I am sorry if you feel that I didn't follow your directions, but I did - to a T, so, please see the site. There isn't anyway for me to include a screen shot, so the closest is to check out the site. I HAVE INSTALLED THE NEW MENU as well and am experiencing the same problem
Beth
I appreciate your attitude and comments. I do have a web work site just starting at http://foothillsweb.ca growing by a page a week, and will be linking back to your site just out of gratitude, and of course for useful information.
I'm surprised you don't have a way to earn on this page (unless I missed it?). It seems to be a sad fact that the worst pages on the web are often the best earning pages. People wind up frustrated that they can't find what they want and click on anything looking for more information. A page with great information just leaves the person happy s/he found what was needed, and then on to the next thing to get done.
best wishes, lloyd
.......__o
.......\
This is an example of you following directions. I said:
Please re-read the directions and follow them exactly. If you have followed my directions exactly, then show me where you installed my menu "as-is" on your site and we'll proceed from there.
Now you reply with no mention of where you installed my menu. Do you not understand what you read? Please my time is valuable, don't waste it.
tedd
When we fill out your comment form it asks for the web site. I had assumed that since you put it on your site, you'd know to check the site. However, I see that you don't.
I am moving on to another menu system that actually works and the person responding to comments isn't rude. MY time is valuable too and I won't waste my time on this system
Good luck and maybe calm down a bit and not be so rude!
Clearly, the link you provided shows that you are throwing all sorts of code together, without following any standards whatsoever, in the hope that everything will somehow work. That's poor coding practice.
You have a lot to learn, in more than just coding.
tedd
I tried the menu, and it works well in Firefox and IE6, but it seems not working in IE8. I followed the instruction and here is the URL
http://www.uastudio.net/menu_test/menu_template.html
I see the menu on your this page does work in IE8. Not sure why.
Thanks!
You need a DOCTYPE to make the menu work correctly.
My bad, I often assume that everyone is creating well-formed and proper web pages with DOCTYPE and such, but sometimes my assumption is wrong.
I'll add the rule in the documentation.
Cheers,
tedd
Can I take it from the last post that as long as the DOCTYPE (which DW adds automatically) is present your code will work with IE8?
Thanks,
Alan
The point here simply is that all documents should have a DOCTYPE and be well-formed -- else, the document will throw the browser into Quirks mode (instead 0f standard mode), which causes the browser to render the page accordingly to its internal rules and not necessarily what you wanted. This is very basic web development concepts that should be realized by all web designers.
Cheers,
tedd
tedd
There are other drop-downs out there that do tab through, but still I would advise people to think very carefully about who they are alienating when using this type of navigation.
:(
Did you look at this page using IE8? If you did, you would see that the menu works and what you said was simply not true. I have thoroughly tested this menu in all IE's (6+ including 8) and the menu works.
tedd
Two issues - I have employed the menu on this page: http://stevenhonigberg.com/testpage.html
Works great in Firefox but absolutely not in IE6, though I thought I followed your instructions precisely (I noted that the code you posted in instruction 2 has an open tag, I did close it after media="screen". Menu css doesn't apply at all with this code left as is).
Also, is there any way to position the menu in the center of the page, regardless of page/screen size?
Thanks again for whatever assistance you can offer,
Brad
First of all, thanks for making this code available and providing attentive, patient support.
I'm attempting to use the menu here: http://stevenhonigberg.com/testpage.html
Two issues: even though I believe I followed your instructions to the letter, the menu will not appear in IE6 (I haven't tested it in IE7). It works perfectly in Firefox. I did note that your css import command in step 2 seems to have an open tag, which I closed after media="screen". The style and menu would not appear at all without taking this step.
My other question - is there any way to position the menu in the absolute horizontal center of the page, regardless of page/screen size?
Thanks so much for any guidance you can provide.
-Brad
Item 2. Is this on purpose?
I notice that when I remove background and border from the elements of the menu, in IE8 the pull down menus will disappear after hovering down below the 5th entry. Is this known behaviour of IE8? If so, is there a work-around?
Thanks for this example and best regards,
Alex
I have tried many other horizontal menu's, but many of them didn't work in IE8. Following the instructions for this menu really accurately didn't get it to dropdown in IE8 either.
Then I copied this webpage (the menu works in IE8 here) and then it did work well in IE8. After this I just deleted everything I didn't need and filled in everything I wanted. Still I didn't succeed in reproducing it myself within HTML-Kit.
Then after a night's sleep I had the idea to take a look at the very first line: !DOCTYPE HTML PUBLIC. I discovered a difference. (I hadn't read the lower part of the comments yet where Tedd has mentioned the DOCTYPE).
The line on the page where the menu works is like this:
This line is also on this webpage.
A new document opened in HTML-Kit gives automatically this line:
and in this one the menu does NOT work in IE8.
I played a little with it:
- Take away the word "Transitional" and the menu works in IE8.
- Add the word "Transitional" again, but add also "http://www.w3.org/TR/html4/strict.dtd": the menu works in IE8.
Anyway this menu was worth trying to find out, because I think it's a great menu, beautifully put together and too complicated for me to create it myself.
Line 1:
This is a great menu; easy to install and well explained. Expect a donation shortly. I do have one issue I'm trying to solve though: I'm using some embedded google earth / google maps on my site and the google earth window always stays in front of the menu, such that you can see the dropdown items. The menu works fine with google maps; it's just with google earth that this strange behavior occurs. Any ideas how I could get the menu to appear on top of the google earth content? Here's a page you can witness this behavior on: http://www.landscapephotoguide.com/index.php?type=earth®ion=California . Try hovering your mouse over the "North America" box, then the "United States" box. There should be a list of states that appears but everything below "Arizona" gets hidden by the google earth window.
Any advice or suggestions would be greatly appreciated. Thanks much.
~Josh
You have a really nice menu system here. I did notice that the top_parent links have an issue where the bottom portion of the button does function as a link when clicked. Meaning the link is not filling the entire button. I found this most prominent in Chrome and Firefox and less noticeable in IE.
Cheers,
Cliff
I'm sorry, but there is just too much spam to review to provide answers. For example, for every honest question, there are over 1000 spams. I am leaving the comments here so that they may help others.
I find my time better spent providing more examples and attending to clients.
tedd