Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS CSS Drop Down Menu

  • This topic is empty.
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #203116
    jcode
    Participant

    Hi, I’m working on a drop down menu based on a nice design I found here, but I have made numerous edits. I’d specifically like to get the Parent UL LI to turn back to white while I’m hovering over the Child UL LI (the UL UL LI), but I’m stumped. Any suggestions? I also had to “force” some styling with a few !important tags — I’d love to get rid of them.

    Here’s the JS Fiddle.

    #203117
    Paulie_D
    Member

    If you make a Codepen.io demo we can take a look.

    #203145
    jcode
    Participant

    Sure thing, here it is in Codepen.

    #203146
    Paulie_D
    Member

    Firstly, there is no selector that will change the styles of a parent based on a child.

    So…my first thought is to switch the background changes to the links…rather than the list item that wraps the link.

    http://codepen.io/Paulie-D/pen/vOxeQR

    #203148
    jcode
    Participant

    Thanks! That solved the immediate problem. Any thoughts on eliminating the !important declarations?

    #203149
    Paulie_D
    Member

    Figure out why you used them in the first place.

    It’s usually because you have specificity problems…a declaration further up (usually) is too broad and so you need to narrow it down by making it more specific to target only the elements you want.

    http://code.tutsplus.com/tutorials/the-30-css-selectors-you-must-memorize–net-16048

    #203194
    jcode
    Participant

    Thanks again for the great advice. I little reordering on the declarations allowed me to eliminate the !important tags.

    Now, I thought it’d be fun to add a transition effect to the drop down on hover. I tried to add a transition declaration, but it only had an effect on colors — any suggestions on how to get the drop down to expand and collapse up and down on hover?

    #203195
    Paulie_D
    Member

    That’s more of a javascript thing.

    You’re using the display property to hide/show the submenus and that can’t be animated.

    I’m not saying it can’t be done with CSS but probably not with what you have there without a great deal of re-tooling.

    #203198
    jcode
    Participant

    I think it’s possible because I found this.

    Just need to figure out how to strip the css and move into my menu

    If the whole menu has to be reworked then so be it, any suggestions are greatly appreciated.

    #203205
    Paulie_D
    Member

    That link doesn’t work for me at all.

    #203209
    jcode
    Participant

    It should work, maybe try it again : )

Viewing 11 posts - 1 through 11 (of 11 total)
  • The forum ‘CSS’ is closed to new topics and replies.