Hybrid CSS Dropdowns

by Eric Shepherd

110 Reader Comments

Back to the Article
  1. another FYI

    On my system, the submenu at arkitrave.com does not work totally either.

    Submenu is always stacked on left edge below Home tab.  And not clickable, as it disappears when I come off the tabs.

    Not a CSS-guru by any means—just here to learn.  I don’t think my Safari config is altered beyond stock.

    But maybe it is just my system…

    Copy & paste the code below to embed this comment.
  2. I built the site well over a year ago, and the dropdowns have nothing to do with this article. They work like a charm in everything except Safari, and I’ve never figured out whether it’s my bad coding or Safari that causes them to break in Safari. I am aware of the problem. Know that it is a different set of code, as the current article works fine in the Safari that I tested in. I’m not sure what the problem is for the older version in 10.2.8.

    Maybe I will go back to JavaScript rollovers :)

    No, seriously, thanks for all the observations from different versions; it is impossible to test for all of these browsers and OSs. I do pretty well with my local PC/Mac Intranet and 9 or so browsers, but it’s all under Win2K or OS10.3.

    I have on my list to fix the indentation problem in IE6 – I don’t yet know what’s causing that and I’ll post something to my site when I figure it out. That said, don’t hold your collective breath, as I’ve got a busy spring coming up.

    Copy & paste the code below to embed this comment.
  3. Excelente artículo … justo lo que buscaba

    Copy & paste the code below to embed this comment.
  4. Hi Eric—Sorry to divert focus to your site… given it’s different code and older. (should have read every response prior to mentioning it)

    Thanks for an outstanding article!!  Was not trying to be a pain-in-the-rear… only trying to explain the issue with 10.2.8 specifically.

    popartpopeye mentioned on page 7 (in not a very helpful way) that his Safari wasn’t working properly.  If he was having the same issues as I—thought you could use some more info about specifics.

    Keep up the great work though!

    Copy & paste the code below to embed this comment.
  5. I’ve implemented the menu on an elastic site with two main problems. 1) (I think everyone has already discovered) My main-level links wrap, but they are then hidden by the “on” sub-nav that is positioned directly below line 1 of the main-nav. Any way around this? (he asks, expecting silence).

    And 2). Because the site is elastic, the sub-nav width needs to be set to 100%. But in IE, when the width is set to 100%, the sub-nav li’s all appear one vertically on top of the other. The only way to render them horizontally is to specify the width of the ul in either em’s or px’s. Anyone know of a way around this?

    NOTE: The implementation is located at the linked site (which is hosted on my computer and may or may not be online). The site is essentially a personal experiment in xml from start to finish. Pay no mind to the content. ;-)

    Copy & paste the code below to embed this comment.
  6. Looking at the final menus in Firefox and IE6 side-by-side reveals that they don’t quite display the same. For example, in Firefox, the header image and menus are flush left. However, in Opera and IE6, this is on a Linux system, the menus start with a space between the left side of the browser window and the edge of the menu instead of flush with the leftside browser window as is the case with Firefox. Is there a way to compensate for this behavior without trashing the display in Firefox? The more I learn about web development the more I loathe Microsoft and IE.

    Copy & paste the code below to embed this comment.
  7. Someone know a menu like this?
    Option1   |  Option2   |  Option3
              option2.1
              option2.2
              option2.3—>option2.3.1
              option2.4 >option2.3.2


    The current no have option2.3.1

    Copy & paste the code below to embed this comment.
  8. In my opinion, CSS has not yet reached a stage where it can gracefully handle complex behavior like nested drop-down menus.

    This is most evident in the example if you hover over the right-most parent (“Digital”) and then quickly move to the left-most child (“Xenakis”).  If you can do this quickly without losing the “Digital” menu items, then you’re more dextrous than the vast majority of mouse-users.

    The CSS :hover pseudo-class simply has no tolerance on most browsers for any accidental mouse jittering.  It would be nice if it could be specified with a given timeout, for example “ul:hover(5)”, but alas, that is not available – and perhaps it shouldn’t be.  The purpose of this pseudo-class is to simply highlight an item when it is clickable, not to provide complicated behavioral scripting capabilities.  CSS is a brilliant language for style, but every “CSS Behavior” hack that I see just seems to be a stretch for no purpose other than showing off what is possible.

    (Granted, that’s a fine purpose and something that should be done in the name of innovation, but it’s not a good methodology for creating accessible and profitable websites!)

    A javascript solution, otoh, can easily be created that will use exactly the same degradible XHTML and similar CSS styling.  In this way, you can allow your users to hover or click a parent, and don’t change it until they hover/click another parent.  This is the default application behavior that most users are used to, and it is more forgiving of often imperfect mouse movements.

    Copy & paste the code below to embed this comment.
  9. Doesn’t degrade either. All you see is the top photo.

    Copy & paste the code below to embed this comment.
  10. who knows.
    It seems I am having problems not with flash
    but with multiple lines of drop downs.

    ————————————————
    drop down1 drop down2 drop down 3
    ————————————————
    ————————————————
    drop down4 drop down5 drop down 6
    ————————————————

    the list hides behind the <ul> heading below it. is this just a z-index or how the flop am
    I supposed to get it to work.  any ideas??

    Copy & paste the code below to embed this comment.
  11. v1…

    Copy & paste the code below to embed this comment.
  12. its based on pixles, but even worse it cannot be zoomed. Thats just crap, nothing else.

    Dropdownmenus in general are a problem, better use asyncronic server connections (ajax) and refresh menus statically, if you mess around with javascript anyway.

    Copy & paste the code below to embed this comment.
  13. Sorry, but this menu isn’t working on IE 5.2 Mac. It is working in Safari.

    Copy & paste the code below to embed this comment.
  14. What if your menu is centered on a page?  How the heck are you supposed to position the sub-navs since this example is crippled by using actual pixels?

    Copy & paste the code below to embed this comment.
  15. “This technique is a bulletproof way to ensure browser compatibility and to maintain usability”.
    I believe the above sentance should be removed from the article; because IMHO this solution has serious issues:
    – poor browser support,
    – text is not scalable,
    – list items are not accessible in IE when JS is disabled,
    – and, AFAIK, tabbing navigation is not possible in any browser.

    Months ago, I have published a solution, trying to address each problem:
    http://www.tjkdesign.com/articles/dropdown/demo.asp

    Copy & paste the code below to embed this comment.
  16. I belive my own take on a pure css menu have better usability than this one. No javascript, just css (except for the virtual pagechange, just for the demo) Take a look at:

    http://derkert.com/ip3/menu/

    Copy & paste the code below to embed this comment.
  17. As a student I apreciate very much. Send more, please.

    Copy & paste the code below to embed this comment.
  18. I tried this and it works very well except the subnavi which disappers immediately when I move the cursor away from a tab. So I can’t access the subnavi at all! Do you have a solution for this? Thanks!

    Copy & paste the code below to embed this comment.
  19. I’m still searching for a CSS solution that is compatible accross all (most) OS platforms and browsers. I liked the look of your menu, but when I tried it on OS-X and IE, I get no menus at all!

    Mac OS 10.3.9 (Apple’s most current), and Internet Explorer for Rel. 5.2.3 (MS’s most current and final version)

    Anyone else have this problem?

    Copy & paste the code below to embed this comment.
  20. The example at http://www.alistapart.com/d/hybrid/hybrid-4.html doesn’t look good after I increased text size in Firefox (Ctrl++) several times.

    Copy & paste the code below to embed this comment.
  21. Your menu behaves badly in Firefox when I increase text size (Ctrl++). Menu items disappear, extraneous lines appear, etc..

    Copy & paste the code below to embed this comment.
  22. Hi Roman,
    Re: my menu (http://www.tjkdesign.com/articles/dropdown/demo.asp)
    AFAIK, it is possible to use “Ctrl+” three times in FireFox without breaking the layout; this corresponds to more than the “largest” text-size in MSIE.
    In any case, I believe it is much better than what the “Hybrid CSS Dropdowns” menu allows ;-)

    Copy & paste the code below to embed this comment.
  23. Probably one of the best css solutions I have seen yet.  I love ALA!

    Copy & paste the code below to embed this comment.
  24. The problem with CSS menus is that navigation is very important and problems with like the flashing effect, cross-browser issues, etc. make it less than ideal.

    Another problem I have with CSS only menus is that it tries to do behaviour in CSS for which CSS was not designed. CSS should IMO be presentation only.

    Also with XHTML markup, CSS styled but Javascript powered navigation you can do some eye candy like the menus I did for my MXR CMS product. see http://mxdemo.infireal.com/ (P.S: the markup is terrible, its on the todo list)
    The menu does a roll-up and fade out effect.

    Copy & paste the code below to embed this comment.
  25. I’m having a problem implementing a list in FireFox.  When I added the style info into my stylesheet, all of a sudden FireFox stopped recognizing all of the stylesheet from that point down.  I can’t figure out what’s causing this problem.  IE can still parse the entire stylesheet, displaying the list properly.  (The list is taken from the ALA 2002 article Taming Lists by the way.)

    Any suggestions?  Thanks!

    Copy & paste the code below to embed this comment.
  26. I was just checking out the linked examples and they look fine in Safari, but totally not working in Explorer??

    Copy & paste the code below to embed this comment.
  27. Sorry for a little off-topic, but I’m struggling with one thing, which maybe you know how to solve

    I want a very simple horizontal menu, based on list

    I’ve done it, but I wanted it to have a custom bullet, so I used list-style: url(/image.gif); in the ul style declaration

    it appeared ok in mozilla, but there is NO image neither in opera nor IE.

    well, if I change the image to just ‘circle’ or ‘square’ it does not appear in those browsers anyway

    Is it possible to to have bullets (custom too) in horizontal menu based on ul ?
    it’s easy to make it in vertical on, but I have not found any example of such menu turned to horizontal…

    thanks

    Copy & paste the code below to embed this comment.
  28. I am in the process of setting this up and I can’t get it to center on the page like the rest of my page does. I have a container div around my whole page with margin-left and margin-right set to auto, but the secondary nav is always left aligned. Anyone know a remedy?

    Copy & paste the code below to embed this comment.
  29. I like this example… :)  what is to say..

    Copy & paste the code below to embed this comment.
  30. I was working several mothes ago on a similar NAV on a client site http://www.cfatb.com/ using extensively the sluckerfish inspiration.

    I enhanced it to fit our requisites and it seems that it works good on many major browsers. Of course the CSS is free to use as well as the HTML code itself. I think I made some mistakes but it works pretty well.

    Copy & paste the code below to embed this comment.