• Resolved Jane Milburn

    (@jane-milburn)


    Hi, I am trying to style and align my sub-menu under Buy Art. I have searched for the answer and have found various css solutions to try but not many for Twenty Seventeen and the code I have at the moment is really messy and I don’t like using !important in css. Also it’s not exactly what I want.

    .sub-menu {font-size: 12px;
    border-color: transparent !important;
    }
    .sub-menu a:hover { color: #800000 !important; }
    .sub-menu li a:hover {
    background-color: #ffffff;
    }
    .sub-menu li a {
    padding: 5px !important;
    }
    .main-navigation ul li.menu-item-has-children.focus:before,
    .main-navigation ul li.menu-item-has-children:hover:before,
    .main-navigation ul li.menu-item-has-children.focus:after,
    .main-navigation ul li.menu-item-has-children:hover:after,
    .main-navigation ul li.page_item_has_children.focus:before,
    .main-navigation ul li.page_item_has_children:hover:before,
    .main-navigation ul li.page_item_has_children.focus:after,
    .main-navigation ul li.page_item_has_children:hover:after {
    display: none;
    }
    #menu-item-1932 a{
    color: #000000 !important;
    }
    #menu-item-1929 a{
    color: #800000!important; }
    #menu-item-1922 a{
    color: #800000 !important;
    }

    I have left the css there for the time being to give you an idea of what i’m trying to achieve. I can remove it if that helps.

    What I would like is as follows –

    The text in the sub-menu to be aligned directly from the beginning of the B.
    Remove the arrow in the sub-menu.
    “Buy Art” to stay black on hover with no pointer showing when hovering over.
    The sub-menu to have no border and a white background.
    The sub-menu text to be black but turn red on hovering.
    When hovering over sub-menu a grey colour flashes up for a second, i’d like to stop this happening.

    I have learnt some css and have a child theme. Sorry, it seems a lot to ask, but I would be grateful if someone could point me in the right direction please.

    The page I need help with: [log in to see the link]

Viewing 13 replies - 16 through 28 (of 28 total)
  • Thread Starter Jane Milburn

    (@jane-milburn)

    Thanks so much, i’ll see what I can do with my broken code first and let you know what happens as soon as I can.

    Thread Starter Jane Milburn

    (@jane-milburn)

    Just read your last message, i’ve removed the code and realised my code may be conflicting. I’ll continue tweaking but will leave until tomorrow. Thanks again.

    Thread Starter Jane Milburn

    (@jane-milburn)

    Hi, most of your code is now working apart from where > is in it.

    I’m still playing around with it and have managed with your code to remove one !important and some of my previous code has been replaced with your’s.

    Is there any way that the hand appears again over Primary Art and Secondary Art in the sub-menu but not on Buy Art? Your code worked for this to remove the hand but i’d like people to see the hand on the sub-menu so they know it’s clickable.

    Thread Starter Jane Milburn

    (@jane-milburn)

    Oh and the arrow next to Buy Art to show there is a sub-menu has gone, can I get this back?

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    the arrow next to Buy Art to show there is a sub-menu has gone, can I get this back?

    I’m sorry I can’t see the problem.

    Which browser and device are you using?

    Thread Starter Jane Milburn

    (@jane-milburn)

    Sorry Andrew, I just had a power cut and had the sub-menu code in Notepad which I lost when my pc shut down, what an idiot, I did not save it! Now i’m starting again with it all, although some of your code will help. I’ll get back to you when sorted. Thanks for replying.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Oh no that’s okay, if you want I can try looking at your site again from afresh and see what I can achieve

    Thread Starter Jane Milburn

    (@jane-milburn)

    I just found some of it in this thread ??

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    And that arrow problem was my fault, I accidentally gave you the code to remove the wrong arrow.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Try using all of this code instead:

    
    /* The text in the sub-menu to be aligned directly from the beginning of the B.*/
    .main-navigation ul li:hover > ul, 
    .main-navigation ul li.focus > ul {
        left: 0.4em;
    }
    
    /* Remove the arrow in the sub-menu. */
    .main-navigation ul li.menu-item-has-children.focus:before, 
    .main-navigation ul li.menu-item-has-children:hover:before, 
    .main-navigation ul li.menu-item-has-children.focus:after, 
    .main-navigation ul li.menu-item-has-children:hover:after, 
    .main-navigation ul li.page_item_has_children.focus:before, 
    .main-navigation ul li.page_item_has_children:hover:before, 
    .main-navigation ul li.page_item_has_children.focus:after, 
    .main-navigation ul li.page_item_has_children:hover:after {
        display: none;
    }
    
    /* “Buy Art” to stay black on hover with no pointer showing when hovering over */
    .main-navigation .menu-item-has-children > a, 
    .main-navigation .page_item_has_children > a {
        cursor: initial;
    }
    
    /* The sub-menu to have no border and a white background. */
    .main-navigation ul ul {
        border: 0;
    }
    
    /* The sub-menu text to be black but turn red on hovering. */
    #site-navigation li li > a,
    #site-navigation li li.current_page_item a {
        color: #000;
    }
    
    /* The sub-menu text to be black but turn red on hovering. */
    #site-navigation li li:focus > a, 
    #site-navigation li li:hover > a,
    #site-navigation li li a:hover, 
    #site-navigation li li a:focus, 
    #site-navigation li li.current_page_item a:hover,
    #site-navigation li li.current-menu-item a:hover, 
    #site-navigation li li.current_page_item a:focus, 
    #site-navigation li li.current-menu-item a:focus {
        color: #800000;
    }
    
    /* When hovering over sub-menu a grey colour flashes up for a second, i’d like to stop this happening. */
    .main-navigation li li:hover, 
    .main-navigation li li.focus {
        background: none;
    }
    

    If that still doesn’t work, can you let me know the detail of your browser & device because on my end it works.

    Thread Starter Jane Milburn

    (@jane-milburn)

    Brilliant, thank you so much:) it all works. I know you cannot take cash for your advice but is there some way I could write a review on your knowledge or any way I can thank you.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Me knowing your issue was solved and you were happy makes me happier than a review or cash could, so I’m glad this was all fixed ??

    Until the next bug!

    Thread Starter Jane Milburn

    (@jane-milburn)

    That is very generous, thank you again and yep until the next bug! ??

Viewing 13 replies - 16 through 28 (of 28 total)
  • The topic ‘Styling the sub-menu.’ is closed to new replies.