Home>Support>Menu bar showing different width on different screens

Menu bar showing different width on different screens

By rossgardens, 9 years ago. Last reply by reva j, 9 years ago.

Hi

I have added the Custom CSS below to bring my menu bar and menu tabs in line with the rest of my website (each row on each page has 10% blank column at each end). I adjusted the figures until it was all aligned. It looks great on my screen but when I looked at my website on a larger screen the menu bar extends wider than the rest of the website. Is there anything I can do to remedy this?
Thanks
Ross

nav.site-navigation.main-navigation.primary{
margin-left: 16.5%;
margin-right: 16.5%;
}
/* Menu Padding Horizontal */

.main-navigation ul li a {
padding-right: 30.90px !important;
padding-left: 30.9px !important;
}

URL: http://rossgardens.co.uk/

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 9 years, 6 months ago Daniel
    Hi, I Work Here

    Hi Rossgardens

    First of all I apologize for the delayed response.

    You can change this with some custom CSS. If you navigate to Appearance > Custom CSS, you’ll get our custom CSS editor. Just add the following code.

    
    @media screen and (min-width: 1600px) {
    
    nav.site-navigation.main-navigation.primary{
    margin-left: 25.3% !important;
    margin-right: 25.3% !important;
    }
    /* Menu Padding Horizontal */
    
    .main-navigation ul li a {
    padding-right: 30.90px !important;
    padding-left: 30.9px !important;
    }
    		}
    

    You need to change the size in px on the following line @media screen and (min-width: 1600px) to meet you needs.

    Try that out and let me know the outcome.

    Cheers

  2. 9 years, 6 months ago rossgardens

    Hi Addo

    Thanks for your response.

    I added the code you suggested to that already in my Custom CSS. With 1600px it brought the menu bar too far in on either side on the larger screen. When I increase to anything above 1600px the menu bar extends wider than the rest of the website again…

    Any further suggestions appreciated.
    Thanks
    Ross

  3. 9 years, 6 months ago Andrew Misplon
    Hi, I Work Here

    Hi Ross

    Can you please try removing your Custom CSS, just the section that relates to the menu. We can achieve the same setup in a little more responsive way. Let’s try:

    .main-navigation {
      max-width: 1200px;
      margin: 0 auto;
    }
    

    You can also increase your mobile menu collapse point under Appearance > Theme Settings > Navigation. If you increase that to say 990, your menu will turn into the mobile menu, just as the collapse beings.

    Try starting with the above and let me know if anything is missing.

    Thanks

  4. 9 years, 6 months ago rossgardens

    Hi Andrew

    Thanks for your suggestion.

    I removed the following code:

    /* Menu Padding Horizontal */

    .main-navigation ul li a {
    padding-right: 30.90px !important;
    padding-left: 30.9px !important;
    }

    and added the code you suggested. This looks fine on my 15″ screen but the menu bar still extends either side beyond the rest of the site on a larger 17″ laptop screen. I’m not sure whether you were also suggesting I remove the following code:

    nav.site-navigation.main-navigation.primary{
    margin-left: 16.5%;
    margin-right: 16.54%;
    }

    I tried removing it but that then extended the menu bar either side beyond the rest of my site on my smaller 15″ laptop screen too..

    When I tried making the Mobile Menu Collapse 990px, it has made my menu bar on my 15″ laptop 2 rows deep instead of 1, made no difference to the extended menu on the 17″ laptop and condensed the menu on my mobile into a single ‘Menu’ tab in the centre of the screen…

    I hope all of the above makes sense to you!

    Thanks
    Ross

    #masthead .hgroup .logo img {
    width:870.30px!important;
    height:173.07px!important;
    margin-left: 12.3%;
    margin-top: -2%;
    }

    #main {
    padding-top: 4px !important;
    padding-bottom: 6px !important;
    }

    .main-navigation {
    max-width: 1200px;
    margin: 0 auto;
    }

    nav.site-navigation.main-navigation.primary{
    margin-left: 16.5%;
    margin-right: 16.54%;
    }

  5. 9 years, 6 months ago Andrew Misplon
    Hi, I Work Here

    What is the end result you’re after? How should the menu look?

  6. 9 years, 6 months ago rossgardens

    I’d like the menu bar to be the same width as the rest of the website on all laptop/desktop screens.

    On mobile, I’d like to keep all menu tabs visible and have them neatly in 2 rows.

    Thanks
    Ross

  7. 9 years, 6 months ago Andrew Misplon
    Hi, I Work Here

    Thanks. Please try my CSS without your related selectors on this area:

    .main-navigation {
      max-width: 1110px;
      margin: 0 auto;
    }
    

    1110px can be adjusted to suit your preferences.

  8. 9 years, 6 months ago Andrew Misplon
    Hi, I Work Here

    Hey Ross

    We don’t officially support customisations, we do our best to help out with small ones. I can help with the requests from your other thread but it’s a bit too much to try solve those challenges with your Custom CSS in place. I’m then troubleshooting on two fronts, the theme’s CSS and your customisations. If you can email through a temporary set of login details to :

    [email protected]

    I’ll jump in as soon as possible. I’ll temporarily remove your Custom CSS, make the change and put it back, you can then decide what to use and not to use.

    The logo issue on mobile issue for example, you’re using static widths for the logo size, that’s causing the problems you’re seeing on smaller displays.

    So, happy to help, but please send some details through so I can take a look with default CSS to start with.

  9. 9 years, 6 months ago Private Message - WordPress

    This is a private message.

  10. 9 years, 6 months ago rossgardens

    Hi Andrew

    Many thanks for looking into it for me. I see, so the Custom CSS coding I added for one thing is creating problems elsewhere…

    Have sent you login details. Many thanks for your help.

    Ross

  11. 9 years, 6 months ago Andrew Misplon
    Hi, I Work Here

    Super, got it. I’ll jump in a little later. Chat then.

  12. 9 years, 6 months ago Andrew Misplon
    Hi, I Work Here

    There were some direct changes made to style.css. I removed the ones I could see. Take a look:

    http://rossgardens.co.uk/

    Let me know what you need from here.

  13. 9 years, 6 months ago Andrew Misplon
    Hi, I Work Here

    The reason those changes need to style.css need to be removed is they will get deleted the next time you update the theme. So better to see things for what they are now and fix with Custom CSS which will survive an update to the theme.

  14. 9 years, 6 months ago rossgardens

    OK, cheers. I wasn’t aware I’d made changes to style.css but thanks for removing anyway if that’s best.
    So from here, I’d like the logo to reach across the top of the page in line with the rest of the website.
    I’d also like the menu bar to reach across the page in line with the rest of the website.
    On mobile I’d like the logo to reach across the top of the page and the menu bar to be in 2 lines if possible.
    Are you able to make these changes for me? Or advise me how to do it from here?
    Thanks Andrew!
    Ross

  15. 9 years, 6 months ago Andrew Misplon
    Hi, I Work Here

    Try now. Be sure to refresh a few times.

  16. 9 years, 6 months ago rossgardens

    Thanks for making those changes Andrew.
    I’d like the logo and menu bar to be in line with the rest of the website layout though. I’ve built it so that each page has has a 10% blank column down either side to create space around the website.
    On my mobile the logo is still squashed in the middle of the screen and the menu bar is 4 rows deep…
    Thanks
    Ross

  17. 9 years, 6 months ago Andrew Misplon
    Hi, I Work Here

    Thanks for the feedback. Custom CSS is laid out pretty neatly now. You can see the max-width’s there. I’ll make those smaller now but if you’re not happy you can jump in and adjust those. I’ll look at the mobile logo now.

  18. 9 years, 6 months ago Andrew Misplon
    Hi, I Work Here

    Logo looks good on reduced browsers size and on iOS Chrome. Please try refreshing several times or clearing browser cache or using private browsing mode.

    I turned caching off during this phase. Once we’re doing head to your caching plugin’s first page to enable caching again.

  19. 9 years, 6 months ago rossgardens

    Hi Andrew
    Thanks for your help.
    Just a few comments:
    1. On my laptop screen: The logo is slightly stretched vertically. Looks fine on my mobile.
    2. On my laptop screen: The tabs in the menu bar don’t quite stretch to the end of the menu bar – when you hover over the tab on the far right a section of the menu bar remains on its right
    3. On my laptop screen: I’d like to reduce the space above the logo
    4. On my laptop screen: I’d like to reduce the space under the menu bar
    5. On my mobile screen: I’d like to reduce the menu bar to 2 rows
    6. On my laptop screen: I’d like to reduce the space between what are the Pagebuilder rows.
    I want to make sure all the coding is set up correctly now so if you could kindly let me know how best to make these amendments (or make them for me) I’d be really grateful.
    Many thanks
    Ross

  20. 9 years, 6 months ago Andrew Misplon
    Hi, I Work Here

    Hey Ross! Thanks for the wait. Mmm, we shouldn’t be battling so much with a simple layout like this. Let me try switching over to the boxed layout and making a change to the logo for the full width look. Back in a sec.

  21. 9 years, 6 months ago Andrew Misplon
    Hi, I Work Here

    Here we go: http://rossgardens.co.uk/. Nice and tidy. I’ve already reduced the menu and logo width from 1080px default to 1010px. If you want that reduced further, let me know.

  22. 9 years, 6 months ago Andrew Misplon
    Hi, I Work Here

    So yeah, let me know if you’re happy with the above. I’ll try dive into your questions after that. Basically, I changed the layout to Boxed from Full Width which makes this all much easier. I then changed the logo area to match the site width area. I also cropped your logo so we can rather handle the logo spacing with CSS. All is viewable under Appearance > Custom CSS :)

  23. 9 years, 6 months ago rossgardens

    Hi Andrew
    Thanks ever so much for taking the time to look into all this for me. Really appreciated.
    The reduced space above the logo is perfect. However, the logo and menu bar now extend either side way beyond the rest of the website. Can they be reduced back in line?
    If you could kindly look into the other issues too that would be super.
    Many thanks again!
    Ross

  24. 9 years, 6 months ago Andrew Misplon
    Hi, I Work Here

    Sure, I’ll take a look now. I’m basically trying to solve that list of problems at a higher level.

  25. 9 years, 6 months ago Andrew Misplon
    Hi, I Work Here

    Ok, so what you created in Page Builder was essentially a content container that was 746px wide. However your columns used for spacing will cause concerns on mobile as they will stack. As a test page I’ve removed the spacing columns on your home page and set the site width to 746 and reduced the menu item spacing. Much more robust. Check that out:

    http://rossgardens.co.uk/

  26. 9 years, 6 months ago Andrew Misplon
    Hi, I Work Here

    Under Appearance > Custom CSS I’ve added two comments that read:

    /* Site Width Control Point */
    

    Those two px values must be the same. You now have the power to set your site width without changing Page Builder columns. So to take over from here what you’d need to do is page by page, delete the extra columns. The use Appearance > Custom CSS to set your site width as required if you don’t like 746px.

    How I did that on the home page was just to create two new rows without the extra columns and the drag the widgets into the new rows, then delete the old rows. Very quick.

  27. 9 years, 6 months ago rossgardens

    Fantastic, thanks Andrew.
    Makes things much simpler!
    You’ve sorted out many of the issues I had.
    Still to resolve:
    1. On my laptop screen: The tabs in the menu bar don’t stretch to the end of the menu bar – when you hover over the tab on the far right a section of the menu bar remains on its right
    2. On my laptop screen: I’d like to reduce the space under the menu bar on all pages except the home page which is fine. In Custom CSS, I tried adding different px values for “padding-bottom: 4px !important;” under “. #main {” but it doesn’t resolve the problem.
    3. On my mobile screen: I’d like to centralise the menu tabs or spread them evenly across the rows if possible.
    Thanks!
    Ross

  28. 9 years, 6 months ago Andrew Misplon
    Hi, I Work Here

    Hey Ross, glad that helped a bit.

    1. The Vantage menu unfortunately isn’t designed to fill the available space, menu items are statically spaced. If you’d like to change that spacing, head to Appearance > Custom CSS and edit the following selector:

    .main-navigation ul li a {
      padding-right: 20px !important;
      padding-left: 20px !important;
    }
    

    2. This property is unfortunately not valid, rather remove it:

    padding-bottom: -20px;

    The best way to resolve this would be to add:

    #main { padding-top: 0; }
    .home #main { padding-top: 35px; }
    

    3. Sure, try the following:

    @media (max-width: 680px) {

    /* Vantage center align the main menu */

    .main-navigation ul {
    font-size: 0;
    text-align: center;
    }

    .main-navigation ul li {
    display: inline-block;
    float: none;
    font-size: 13px;
    }

    .main-navigation ul ul li {
    text-align: left;
    }

    }

    Notes: The following is a comment in CSS:

    /* I am a comment, I don't do anything, just for info purposes */
    

    When adding new CSS try add comments as you go, or place new CSS within sections I’ve already commented. Makes it easier to come back at a later stage and understand what’s going on.

  29. 9 years, 6 months ago rossgardens

    Hi Andrew
    Many thanks indeed for all the help you’ve given me resolving these issues. I’m pretty happy with how it looks now. You’ve been super helpful.
    The only issue is that when I inserted the coding for issue 1 above (to spread the menu tabs across the menu bar), it made the menu bar on my mobile 3 layers deep – it looked much better as 2 layers. Is there any way around this?
    Thanks again
    Ross

  30. 9 years, 6 months ago Andrew Misplon
    Hi, I Work Here

    Hey Ross, yeah no problem, glad we could help.

    I lose track sometimes but I think you added this section:

    .main-navigation ul li a {
      padding-right: 30.5px !important;
      padding-left: 30.5px !important;
    }
    
    @media (max-width: 680px) {
    
    /* Vantage center align the main menu */
    
    .main-navigation ul {
    font-size: 0;
    text-align: center;
    }
    
    .main-navigation ul li {
    display: inline-block;
    float: none;
    font-size: 13px;
    }
    
    .main-navigation ul ul li {
    text-align: left;
    }
    
    }
    

    Just a few notes there:

    * As far as I know half pixels don’t work.

    * If you scroll up a bit you’ll see a menu section that I created with a comment. There is already a selector there for menu padding and another for menu padding below 680, those will both be overwritten by the 30.5px added later.

    * The center align menu CSS that’s been added is only applicable below 680px. Was that intentional? If so, perfect.

    Here is what I recommend:

    1. Remove this:

    .main-navigation ul li a {
      padding-right: 30.5px !important;
      padding-left: 30.5px !important;
    }
    

    Scroll up to /* Menu */ and rather edit the padding there. I’ve got padding general and then padding below 680. Mobile should go onto two lines once you remove the 30.5px.

    Perhaps put/move the following just above /* Main */ so it’s in the menu section. Easier to see what’s going on that way (can you tell I’m a little OCD :) )

    @media (max-width: 680px) {
    
    /* Vantage center align the main menu */
    
    .main-navigation ul {
    font-size: 0;
    text-align: center;
    }
    
    .main-navigation ul li {
    display: inline-block;
    float: none;
    font-size: 13px;
    }
    
    .main-navigation ul ul li {
    text-align: left;
    }
    
    }
    
  31. 9 years, 6 months ago Andrew Misplon
    Hi, I Work Here

    Here is your complete Custom CSS after making the changes I’m proposing. I also moved the #main selectors into that section and set #main padding bottom to 0 because it’s not possible to use negative padding, only negative margin.

    Please hit me up with any questions.

    /* Page Wrapper */#page-wrapper {	max-width: 850px !important; /* Site Width Control Point */	padding-top: 20px !important;}@media (max-width: 1080px) {	.responsive.layout-boxed #page-wrapper {    	margin: 0 auto;    	padding: 0 2.5%;	}}/* Full header logo */header#masthead {	padding: 0 !important;}header#masthead .hgroup {	padding: 0 !important;}header#masthead .hgroup .logo {	margin-bottom: 20px;}header#masthead .hgroup .logo img {	height: auto;	max-width: 850px; /* Site Width Control Point */}.main-navigation {	margin: 0 !important;}body.responsive header#masthead .hgroup .support-text, body.responsive header#masthead .hgroup #header-sidebar {	display: none !important;}/* Menu */.main-navigation ul li a {	padding-right: 20px !important;	padding-left: 20px !important;}@media (max-width: 680px) {  	.main-navigation ul li a {		padding-right: 10px !important;  		padding-left: 10px !important;  	}}/* Center align the main menu below 680px */@media (max-width: 680px) {	.main-navigation ul {		font-size: 0;		text-align: center;	}	.main-navigation ul li {		display: inline-block;		float: none;		font-size: 13px;	}	.main-navigation ul ul li {		text-align: left;	}}/* Main */#main { 	padding-right: 0;	padding-bottom: 0;	padding-left: 0;}#main { 	padding-top: 0; }.home #main { 	padding-top: 20px; }/* Footer */#colophon {	margin-bottom: 0;}
  32. 9 years, 6 months ago rossgardens

    Wonderful, thanks Andrew,
    I tried changing the padding on the coding below to 30px each side – that was slightly too small. So I tried 31 each side, which was slightly to large. So I tried 30.5 again and that was perfect, so looks like 0.5px do work.
    Many thanks again
    Ross

    /* Menu */.main-navigation ul li a {	padding-right: 20px !important;	padding-left: 20px !important;}
  33. 9 years, 6 months ago Andrew Misplon
    Hi, I Work Here

    Super, if that’s working then it’s 100%. I did some reading now, in most cases using .5 should be fine.

    Let me know if you need a hand with anything further.

  34. 9 years, 6 months ago rossgardens

    Shall do.
    Many thanks indeed Andrew
    Ross

  35. 9 years, 4 months ago Private Message - reva j

    This is a private message.

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More