We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6726
    • 7,075 Posts
    Here is my problem : I had to built a pure css menu, 3 levels, for a website I am working on. I have managed to get something working in FF, Opera and Safari (except a width problem on the third menu level when I hover second level) but IE (what a surprise) has caused me great trouble. It just doesn’t work.

    First level items have to be fixed, IE is not calculating things as other browser but I can manage this.
    My biggest issue is, when I hover first level menu items, second level items do not show.

    At first, I thought I had forgotten to add the magic csshover.htc fix to have the "hover anything" support for IE. When I saw that I *had* added the htc stuff, I did some digging. Alright, Windows XP SP2 had introduced yet another layer of complexity : .htc files now have to be server as text/x-component to work (which can be done adding "AddType text/x-component .htc" to your .htaccess file).

    This being done, I should now have a working menu, but I don’t.

    I found myself re-reading my css for start to end.
    At first, I thought z-index could explain why the second and third level items did not show up, thus defined it with a high value. No change.
    Then, I thought positionning was the issue. The #logo and #photo divs are defined with absolute positionning. Indeed, when I drop those two divs, I can see my second and third menu items, so it’s not the hover anything stuff which is faulty.

    It has to be positionning but I am more than a bit tired (clocked a lot of hours lately tongue) and I just can’t see how I can come out of this without redefining the layout, which I am reluctant to do... Before I go down that road, I wanted to run this by you, I am pretty sure I missed something more or less obvious but I am in it now and miss the perspective to see it....

    Here is the url, I have added a mock menu item to have the three levels displayed (originally, only the private section has 3 levels).
    http://ns20999.ovh.net/~gican/

    If someone has an idea, I’d appreciate it !

    I am banging my head with this undecided







      .: COO - Commerce Guys - Community Driven Innovation :.


      MODx est l'outil id
      • 25663 MODX Staff
      • 12,272 Posts
      Welcome to CSS menus, where nothing makes sense when it comes to IE.

      I would seriously advocate using an IE Conditional Comment and brute forcing IE into submission with an IE-only stylesheet. It’s likely a width-related problem and a double-margin bug and several other things.
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 7923
        • 4,213 Posts
        This is not goint to help much probably, but if you want, you could ask stu for permission to use his menu in a commercial site and then use the flyout menu that is in wayfinder package.. It works on IE5.5, IE6, IE7, Firefox, Opera, Mozilla and Netscape (not sure about Mac IE, but you can test here) and is truly pure css.


          "He can have a lollipop any time he wants to. That's what it means to be a programmer."
          • 22815
          • 1,097 Posts
          Quote from: davidm at Sep 19, 2006, 05:19 PM

          The #logo and #photo divs are defined with absolute positionning. Indeed, when I drop those two divs, I can see my second and third menu items, so it’s not the hover anything stuff which is faulty.

          So it’s a clash between the menu and the logo and the photo divs? I notice that the photo does some funky fadey thing. I’ve not looked how they work. Do your menu items still show if you have static images there?

          EDIT: I’ve now seen that the fadey thing uses JS (which makes your insistence on pure CSS menu somewhat strange) and is far enough away from the menu not to affect the second-level. But your logo uses png. What happens if you use gif or jpg there?
            No, I don't know what OpenGeek's saying half the time either.
            MODx Documentation: The Wiki | My Wiki contributions | Main MODx Documentation
            Forum: Where to post threads about add-ons | Forum Rules
            Like MODx? donate (and/or share your resources)
            Like me? See my Amazon wishlist
            MODx "Most Promising CMS" - so appropriate!
            • 22303 MODX Staff
            • 10,725 Posts
            Could it be a "cascading" effect due to this javascript error...which I get in IE only...

            Line: 204
            Char: 26
            Error: Can’t move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus.
            Code: 0

            or some of the errors in the CSS...

            Error: Expected ’:’ but found ’size’. Declaration dropped.
            Source File: http://ns20999.ovh.net/~gican/css/communs.css
            Line: 146

            Error: Unknown property ’backrgound-color’. Declaration dropped.
            Source File: http://ns20999.ovh.net/~gican/css/communs.css
            Line: 651

            Error: Error in parsing value for property ’border-spacing’. Declaration dropped.
            Source File: http://ns20999.ovh.net/~gican/css/communs.css
            Line: 654

            Error: Selector expected. Ruleset ignored due to bad selector.
            Source File: http://ns20999.ovh.net/~gican/css/communs.css
            Line: 682

            Or one of the 18 XHTML validation errors, like this one:
            Error  Line 267 column 7: end tag for "html" omitted, but OMITTAG NO was specified.
            
            </body>
            
            You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".
            


            Those are just some of the things that stood out when I visited. Hope that helps you sort it out...
              • 6726
              • 7,075 Posts
              Thanks everyone for the help, much appreciated grin
              I’ll use your input to give this a second look and report with (hopefully) the solution


              Quote from: rthrash at Sep 19, 2006, 05:28 PM
              Welcome to CSS menus, where nothing makes sense when it comes to IE. I would seriously advocate using an IE Conditional Comment and brute forcing IE into submission with an IE-only stylesheet. It’s likely a width-related problem and a double-margin bug and several other things.

              It would be a last resort, usually I don’t need and IE stylesheet and frankly, I don’t like double maintenance it entails...

              Quote from: doze at Sep 19, 2006, 05:29 PM
              This is not goint to help much probably, but if you want, you could ask stu for permission to use his menu in a commercial site and then use the flyout menu that is in wayfinder package.. It works on IE5.5, IE6, IE7, Firefox, Opera, Mozilla and Netscape (not sure about Mac IE, but you can test here) and is truly pure css.

              Maybe I should have used the provided flyout instead of starting from scratch indeed... It’s the first time I use Wayfinder to build a menu in fact, and it’s probably the best dynamically generated menu system I have ever seen. Some things puzzle me though, like the &levelClass parameter : it thought it would increment the class of the <ul> of each level (would have been nice), but what it does is add the level class to all <li> from a level. Maybe I missed something there...

              Quote from: PaulGregory at Sep 19, 2006, 05:33 PM
              So it’s a clash between the menu and the logo and the photo divs? I notice that the photo does some funky fadey thing. I’ve not looked how they work. Do your menu items still show if you have static images there?

              EDIT: I’ve now seen that the fadey thing uses JS (which makes your insistence on pure CSS menu somewhat strange) and is far enough away from the menu not to affect the second-level. But your logo uses png. What happens if you use gif or jpg there?

              Thanks, I wouldn’t have tried to change the image type, but that would make sense that IE is generating problems with PNGs. I’ll try that !

              As for my insistence to have a pure CSS menu, I don’t think it’s inconsistent with using js elsewhere. In this case the client asked for a slideshow and wanted nice transition effects. Flash was out of the question, but small js is nice : it’s not there yet but I will provide an alternate picture for those who have javascript off.

              The reason why I want CSS menu is : it degrades well. A menu is too important a thing to be build using javascript, not to mention the search engine optimisation aspect. A slideshow hardly qualifies as being an essential element. That’s my reasonning there.

              Quote from: OpenGeek at Sep 19, 2006, 06:42 PM
              Could it be a "cascading" effect due to this javascript error...which I get in IE only...

              Line: 204
              Char: 26
              Error: Can’t move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus.
              Code: 0

              I didn’t see that !
              Thanks I’ll look into it smiley


              Quote from: OpenGeek
              or some of the errors in the CSS...

              I’ll check those too... I usually run the validator when I am stuck, didn’t think of it this time tongue


              Quote from: OpenGeek
              Or one of the 18 XHTML validation errors, (...) Hope that helps you sort it out...

              It sure will help, I didn’t yet validate any pages, I usually do at the end but I’ll sure give a long look at those too...



                .: COO - Commerce Guys - Community Driven Innovation :.


                MODx est l&#39;outil id
                • 7923
                • 4,213 Posts
                Quote from: davidm at Sep 20, 2006, 02:10 AM

                As for my insistence to have a pure CSS menu, I don’t think it’s inconsistent with using js elsewhere. In this case the client asked for a slideshow and wanted nice transition effects. Flash was out of the question, but small js is nice : it’s not there yet but I will provide an alternate picture for those who have javascript off.

                The reason why I want CSS menu is : it degrades well. A menu is too important a thing to be build using javascript, not to mention the search engine optimisation aspect. A slideshow hardly qualifies as being an essential element. That’s my reasonning there.
                I can’t think the menu as being pure css if it needs csshover.htc ..


                  "He can have a lollipop any time he wants to. That's what it means to be a programmer."
                  • 6726
                  • 7,075 Posts
                  Quote from: doze at Sep 20, 2006, 03:48 PM
                  I can’t think the menu as being pure css if it needs csshover.htc ..

                  Good point. But it’s only for IE, and I don’t know how many multi-level pure CSS menu are working with IE ?

                  Apparently Stu has made it, but it involves some strange use of tables which semantically means nothing to me... I still have to grasp what the intent was to start with.

                  the html :

                  <li><a [+wf.classes+] href="[+wf.link+]" title="[+wf.title+]">[+wf.linktext+]</a>
                  
                      <!--[if lte IE 6]>
                      <a class="sub" href="[+wf.link+]" title="[+wf.title+]">[+wf.linktext+]
                      <table><tr><td>
                      <![endif]-->
                  
                      [+wf.wrapper+]
                  
                      <!--[if lte IE 6]>
                  	</td></tr></table>
                      </a>
                      <![endif]-->
                  
                  </li>


                  the css :

                  .menu ul li a.hide, .menu ul li a:visited.hide {display:none;}
                  .menu ul li a:hover ul li a.hide {display:none;}
                  
                  .menu ul li a:hover {color:#fff; background:#36f;}
                  .menu ul li a:hover ul {display:block; position:absolute; top:21px; left:0; width:105px;}
                  .menu ul li a:hover ul li a.sub {background:#6a3; color:#fff;}
                  .menu ul li a:hover ul li a {display:block; background:#ddd; color:#000;}
                  .menu ul li a:hover ul li a ul {visibility:hidden;}
                  .menu ul li a:hover ul li a:hover {background:#6fc; color:#000;}
                  .menu ul li a:hover ul li a:hover ul {visibility:visible; position:absolute; left:105px; top:0; color:#000;}
                  .menu ul li a:hover ul li a:hover ul.left {left:-105px;}
                  


                  As you can see, there is some CSS hack to workaround IE’s limitations... frankly I am not sure which is cleaner : use a .htc file or a CSS hack which involves some semantically bizarre stuff...

                  I am all for web standards and all CSS approach.
                  But with IE, you have to do some not-so-clean stuff : Stu’s code is lighter than a htc file, it’s true, but in the end I’ll choose the most practical solution, not necessarily the cleanest purest compliant one...

                  I did not check how stu’s method degrades, but the .htc stuff degrades OK thus if it works, I will go down that road (unless a better alternative arises)
                  More than absolute standard compliancy, the main goal is user experience... standard compliant browsers will get standard compliant code, IE will get whatever is best in the long run and does not make the code dirty with conditionnal comment in the html and all...

                  That’s my opinion...

                  Edit : It seems Stu has built a new cross browser flyout since the first one always using the nested table hack... but apparently combining styles (no more ie stylesheet)
                  http://www.cssplay.co.uk/menus/flyout2.html

                  I’ll dig into that !

                  Edit 2 : Stu’s code is really clean and light and smart... the nested table stuff aside, it’s really something !
                  If he allows me to use his code, I will.

                  But not before I try to clean my own code to get rid of all the unclean / un-necessary things there and fix this thing. Who knows, it might work... and I sure will learn things in the process...
                    .: COO - Commerce Guys - Community Driven Innovation :.


                    MODx est l&#39;outil id
                    • 22815
                    • 1,097 Posts
                    I’ve used tables in a dropdown menu before now. If you want a series of boxes on top of each other.. in fact if you ever have either a row or a column, tables are the easiest and most universally browser-safe way to achieve them.

                    In page layouts, I’m not dropping tables until CSS3’s "Template-based positioning" is available to the majority of users. (At the moment, it’s not available to anyone AFAIK).

                    IE understands tables, and wrapping A around a table makes a large clickable area of the right size.
                    For whose benefit do "semantics" within a template matter? Looking and working right has to take priority. Just don’t worry about it.
                      No, I don&#39;t know what OpenGeek&#39;s saying half the time either.
                      MODx Documentation: The Wiki | My Wiki contributions | Main MODx Documentation
                      Forum: Where to post threads about add-ons | Forum Rules
                      Like MODx? donate (and/or share your resources)
                      Like me? See my Amazon wishlist
                      MODx "Most Promising CMS" - so appropriate!
                      • 6726
                      • 7,075 Posts
                      Ok thank you for explaining this nested table thing to me... I can see how it makes sense now.

                      I couldn’t agree more that being pragmatic has to take priority. But I sure wouldn’t use a technique which I don’t understand is all I am saying. Don’t be mistaken, I am not saying the logic behind the nested table is not a smart workaround for IE. But it’s almost too smart for me, actually tongue
                        .: COO - Commerce Guys - Community Driven Innovation :.


                        MODx est l&#39;outil id