Working CSS dropdown

Discussion in 'HTML & Website Design' started by enchance, May 12, 2008.

  1. #1
    My 100% CSS dropdown works! There's just one minor detail I hope you guys could help me out with. In IE the menu works flawlessly but in Firefox once I move my cursor from the main menu to the dropdown menu, the menu rollover goes back to its original state (doesn't remain in the rollover state), but in IE it remains in its rollover state which is how a dropdown should really work.

    Test the sample I made in both Firefox and IE to see for yourself.
    I got the original code from Stu Nicholls.
     
    enchance, May 12, 2008 IP
  2. crath

    crath Well-Known Member

    Messages:
    661
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    100
    #2
    Works fine for me in both browsers :\
     
    crath, May 12, 2008 IP
  3. enchance

    enchance Peon

    Messages:
    109
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Really? In FF and IE? :confused:
     
    enchance, May 12, 2008 IP
  4. crath

    crath Well-Known Member

    Messages:
    661
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    100
    #4
    crath, May 12, 2008 IP
  5. enchance

    enchance Peon

    Messages:
    109
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    That's not quite it since the rollover on the menubar went back to being "unrolloved." But it's ok, I found the solution in another forum and it works flawlessly in IE5/6 FF2/3. You can check out my post here.

    Special thanks also to crath for those screenshots.
     
    enchance, May 13, 2008 IP
  6. crath

    crath Well-Known Member

    Messages:
    661
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    100
    #6
    Oh, you ment to ask, how to make the main nav bar link keep its "hover" state while over a sub menu?
     
    crath, May 13, 2008 IP
  7. blueparukia

    blueparukia Well-Known Member

    Messages:
    1,564
    Likes Received:
    71
    Best Answers:
    7
    Trophy Points:
    160
    #7
    The :focus and :activer pseudo classes - look into them.
     
    blueparukia, May 13, 2008 IP
  8. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I've never figured out how to do it in IE6, but for the rest, it's pretty much something like,
    #menu :hover > a {
    hoverstyles here
    }

    Meaning, whenever anything inside the whole menu is hovered, the direct child a's (meaning, the first-level menu items) do hoverstyles. IE6 doesn't understand the > so not sure what stu does with them.

    Doesn't work with focus because while hovering on the sub counts as hovering over the whole parent, this is not so with focus.
     
    Stomme poes, May 13, 2008 IP
  9. crath

    crath Well-Known Member

    Messages:
    661
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    100
    #9
    Ie6 doesn't know how to do much at all, and I don't worry about it as much anymore because ie7 has been pushed has a highly recommended security update, so most people have upgraded that are running windows update.
     
    crath, May 13, 2008 IP
  10. michielmetdepet

    michielmetdepet Peon

    Messages:
    41
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
  11. blueparukia

    blueparukia Well-Known Member

    Messages:
    1,564
    Likes Received:
    71
    Best Answers:
    7
    Trophy Points:
    160
    #11
    Ahh...deathshadow gave me a working one a long while ago, I'll see if I can find it.
     
    blueparukia, May 13, 2008 IP
  12. enchance

    enchance Peon

    Messages:
    109
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #12
    How about JavaScript to replace the lines above since IE6 is a retard?
     
    enchance, May 14, 2008 IP
  13. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #13
    Not to replace, but to add-- that is, keep the above code for all the smart browsers (in this case, also includes IE7) because all my menus work in all the smart ones... just "add" Javascript for our retarded friend... those without Javascript, fine, it's only enhancing the site for those with IE6 : )

    though if blueparukia comes up with whatever deathshadow did and it works, then that'll also be good.

    http://stommepoes.nl/Menus/suckerfish4ie7.html I've got the tops staying hover-states in everyone but 6 (and actually, I have nothing in 6 because I don't actually have the Peterned whatever:hover.htc file on my server... lazy : ) But adding the whatever:hover, the subs would show and just the tops wouldn't stay hovered.
     
    Stomme poes, May 15, 2008 IP
  14. blueparukia

    blueparukia Well-Known Member

    Messages:
    1,564
    Likes Received:
    71
    Best Answers:
    7
    Trophy Points:
    160
    #14
    blueparukia, May 16, 2008 IP
  15. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #15
    Mine does too, everyone needs something for IE6, but I see what he does:
    #menu li:active,
    #menu li:focus,
    #menu li:hover {
    background:#CDE;
    }

    instead of setting a hover style on the a's, he does it on the li's, and becuase the sub ul is a child of the li and not the a, hovering over the child counts as hovering over the parent here (my interpretation anyway). Then at the bottom he's got the #DDD colour (or is that just his Carlos Mencia reference?) so that the sub li's are actually different hoverstyle.
     
    Stomme poes, May 16, 2008 IP