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
  • 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 useful to you. Thanks!

Zygmunt Spray
Squarespace Website Designer
Contact me: https://squarefortytwo.com/ 
🔌Ghost Squarespace Plugins (Referral link)
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

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.