Site logo

[Resolved] Primary Navigation Background Color for Mobile

Home Forums Support [Resolved] Primary Navigation Background Color for Mobile

Home Forums Support Primary Navigation Background Color for Mobile

Viewing 15 posts - 1 through 15 (of 21 total)
  • Author
    Posts
  • #2098833
    Georgi

    Hello,

    I set the Primary Navigation Background color to purple and I thought this would work only on dekstop but I see that it has affected mobile too: https://prnt.sc/26lvsfq

    Can the primary navigation background be purple only on PC devices?

    #2098946
    David
    Staff
    Customer Support

    Hi there,

    can you share a link to your site, and let me know what color you want the Mobile header ?

    #2099192
    Georgi

    Hi,

    Yes. Info in private area. I want the mobile header to be white/transparent as it is as default. Only the dekstop header to be purple.

    #2099318
    Leo
    Staff
    Customer Support

    Can you set the customizer option for the desktop color you want, then we can provide the CSS specifically for mobile?

    Let me know ๐Ÿ™‚

    #2099325
    Georgi

    I’ve set the customizer option for dekstop.

    #2099500
    Elvin
    Staff
    Customer Support

    Hi Georgi,

    The quick and easy way to add a different background color for mobile-header would be this CSS:

    @media (max-width:768px){
        nav#mobile-header {
            background-color: red;
        }
    }

    Here’s how to add css – https://docs.generatepress.com/article/adding-css/

    You can change red to your preferred color. ๐Ÿ™‚

    Let us know if you need further help.

    #2099608
    Georgi

    Thanks, Elvin!

    I added it to already existing CSS:

    @media (max-width: 768px) {
        .main-navigation.has-branding .inside-navigation.grid-container {
            flex-wrap: nowrap;
            background-color: white;
        }

    It works, so I guess this is not a mistake I did it this way instead of separate CSS? If so you can mark the thread as resolved ๐Ÿ™‚

    #2099613
    Elvin
    Staff
    Customer Support

    Ah yes that can work as well since .main-navigation is also a selector(class) of #mobile-header.

    This should tidy things up. ๐Ÿ™‚

    Marking this as resolved. Let us know if you need further help. ๐Ÿ˜€

    #2099620
    Georgi

    One more thing actually – I didn’t have working mobile menu and just fixed it by assigning an off canvas menu and noticed that its purple there too ๐Ÿ˜€ Can I make it white? https://prnt.sc/26m8abe

    #2099653
    Elvin
    Staff
    Customer Support

    Ah that’s one issue in using .main-navigation.

    This particular CSS is used on BOTH the offcanvas menu and the mobile-header. That’s actually why I recommended using #mobile-header so it will specifically apply to the #mobile-header only. ๐Ÿ™‚

    Considering reverting the change you’ve made on .main-navigation and apply the color through my suggested CSS. ๐Ÿ˜€

    #2100324
    Georgi

    M, I reverted the change on .main-navigation and applied the color through your CSS but it didn’t affect the offcanvas menu. Only the mobile header.

    #2100825
    Elvin
    Staff
    Customer Support

    M, I reverted the change on .main-navigation and applied the color through your CSS but it didnโ€™t affect the offcanvas menu. Only the mobile header.

    Yes that was the intended behavior. Were you aiming for something else?

    This would be the expected css your site should be using if you only want the color purple on the mobile-header and ensure the offcanvas has white.

    @media (max-width:768px){
    /* Mobile header bar */
        nav#mobile-header {
            background-color: purple;
        }
    /* Off-Canvas panel */
        nav#generate-slideout-menu .inside-navigation {
            flex-wrap: nowrap;
            background-color: white;
        }
    }
    #2100916
    Georgi

    The goal is to have the mobile header and offcanvas white. With this CSS now it can be achieve. Thank you ๐Ÿ™‚

    Another problem I’m facing is that the cart and search icons in the mobile header are white too so they cant be seen. How can I change their color specificaly for mobile header?

    #2100918
    Elvin
    Staff
    Customer Support

    You can add this in on the @media rule for mobile.

    nav#mobile-header .menu-bar-items span.gp-icon svg {
        fill: white;
    }
    #2100925
    Georgi

    M, I actually can’t get it to work when adding it to this code:

    @media (max-width:768px){
    /* Mobile header bar */
        nav#mobile-header {
            background-color: white;
        }

    Tried putting it several ways, none was successful.

Viewing 15 posts - 1 through 15 (of 21 total)
  • You must be logged in to reply to this topic.