Jump to content

How to center the secondary nav on mobile (via Custom CSS)?

Go to solution Solved by Ziggy,

Recommended Posts

Hello, I'm praying someone can help, hehe, as I've come up against the limit of my CSS knowledge!

I've used the following custom CSS to center my mobile menu, for my Squarespace 7.0 Brine site, and it looks great:

  /* center mobile navigation menu*/
  
  .Mobile-overlay-nav-item, .Mobile-overlay-folder-item {
  text-align: center;
  }
  
  .Mobile-overlay-menu {
    width: 100%;
    z-index: 1;
  }

/*end code*/

 

This is the result:

image.thumb.png.2c6d05c33372102b58a0751b40a4bcc6.png

 

However, as you can see the secondary nav is a button (as I specified in my Site Styles) and it is for some reason still justified left. I've tried a number of things, inspecting the page elements and trying to force it with code like:

 

.Mobile-overlay-nav-Mobile-overlay-nav--secondary {justify: center; text-align: center;} but that doesn't change it and I'm sure I'm making a basic error in the CSS. Can you point me right?

Thank you so much!

Ryan x

Link to comment

@ryannell Hopefully we can get this fixed for you, can you share your website URL?

Please like and upvote if my comments were helpful to you. Cheers!

Zygmunt Spray
Squarespace Website Designer
Contact me: 
https://squarefortytwo.com 
Hire me on Upwork!

🔌 Ghost Squarespace Plugins (Referral link)
📈 SEO Space (Referral link)
 SquareWebsites Plugins (Referral link)
 🔲 SQSP Themes (Referral link) 
Spark Plugin (Referral link) 

 Did I help? Buy me a coffee?

Link to comment
  • Solution

Well you can try this to get started in your Custom CSS:

.tweak-mobile-overlay-menu-secondary-style-button:not(.tweak-mobile-overlay-menu-secondary-inherit).tweak-mobile-overlay-menu-secondary-button-style-solid .Mobile-overlay-nav--secondary .Mobile-overlay-nav-item {
    margin-left: auto;
    margin-right: auto;
}

Let me know if that doesn't work, or if it does!

Please like and upvote if my comments were helpful to you. Cheers!

Zygmunt Spray
Squarespace Website Designer
Contact me: 
https://squarefortytwo.com 
Hire me on Upwork!

🔌 Ghost Squarespace Plugins (Referral link)
📈 SEO Space (Referral link)
 SquareWebsites Plugins (Referral link)
 🔲 SQSP Themes (Referral link) 
Spark Plugin (Referral link) 

 Did I help? Buy me a coffee?

Link to comment

@ryannell looks like the code I gave you worked? Give me a thumbs if it did!

Please like and upvote if my comments were helpful to you. Cheers!

Zygmunt Spray
Squarespace Website Designer
Contact me: 
https://squarefortytwo.com 
Hire me on Upwork!

🔌 Ghost Squarespace Plugins (Referral link)
📈 SEO Space (Referral link)
 SquareWebsites Plugins (Referral link)
 🔲 SQSP Themes (Referral link) 
Spark Plugin (Referral link) 

 Did I help? Buy me a coffee?

Link to comment
On 10/28/2022 at 12:21 PM, Ziggy said:

Well you can try this to get started in your Custom CSS:

.tweak-mobile-overlay-menu-secondary-style-button:not(.tweak-mobile-overlay-menu-secondary-inherit).tweak-mobile-overlay-menu-secondary-button-style-solid .Mobile-overlay-nav--secondary .Mobile-overlay-nav-item {
    margin-left: auto;
    margin-right: auto;
}

Let me know if that doesn't work, or if it does!

It worked! Thank you Ziggy, you're a life saver, a scholar and a gent!

Link to comment
  • 3 months later...

Hi @Ziggy, hope you're really great! Would you mind awfully taking a look at my footer source code at www.levitate.london and seeing if you can spot why everything in the footer menu is off-center on mobile?

 

I used this custom CSS, which looks fab on desktop:

// center footer navigation - desktop //

.Footer-middle {
  justify-content: center;
  text-align: center;
  }

 

And this for mobile, which strangely is a little to the right of center (though to be fair I really don't fully understand CSS):


// center footer navigation - mobile //
@media @mobile {
  nav.Footer-nav * {
    width: 100% !important;
    max-width: unset !important;
    text-align: center !important;
    justify-content: center !important;
    }
 
  .Footer-business {
    display:none !important;}
}

 

Much appreciate any help (and also that you mightn't have time for this)!!

Thanks again,

Ryan

 

 

Screenshot 2023-02-07 at 08.40.42.png

Link to comment

The max-width:100%; is causing the offset since there isn't room for 100% width given the padding.

Try adding this:

.tweak-footer-layout-columns .Footer-nav-group {
  padding:0px;
}

 

Please like and upvote if my comments were helpful to you. Cheers!

Zygmunt Spray
Squarespace Website Designer
Contact me: 
https://squarefortytwo.com 
Hire me on Upwork!

🔌 Ghost Squarespace Plugins (Referral link)
📈 SEO Space (Referral link)
 SquareWebsites Plugins (Referral link)
 🔲 SQSP Themes (Referral link) 
Spark Plugin (Referral link) 

 Did I help? Buy me a coffee?

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.