Center the main menu and also reduce menu padding.

  • Unknown's avatar

    Hi.

    I’m looking for some help with custom CCS using the Hemingway Rewritten theme.

    I have successfully managed to center the main navigation bar on my site using the css alteration below:

    .blog-menu {
        text-align: center;
    }
    
    .blog-menu > li {
        float: none;
        display: inline-block;
    }

    However I would also like to reduce the spacing between each of the individual menu items. I have tried adding the following however this extra rule seems to cancel out the existing “center” rule:

    .main-navigation a {
        padding: 10px;
    }

    I’m sure I have made a basic error but I’d be extremely grateful if someone could recommend a solution that would allow both rules to apply.

    Thanks
    Fred

    The blog I need help with is: (visible only to logged in users)

  • Unknown's avatar

    Hiya Fred,

    Too narrow?

    .menu-menu-1-container ul li a {
        padding-left: 5px;
        padding-right: 5px;
    }
  • Unknown's avatar

    Hi

    Thanks for replying,

    Your command works in terms of the padding but it doesn’t seem to fix the issue of centering the menu items… They appear justified to the left of the menu bar which doesn’t look great on larger screens.

    Thanks
    Fred

  • Unknown's avatar

    Here you go!

    .main-navigation ul {
        text-align: center;
    }
    
    .main-navigation li {
        display: inline-block;
        float: none;
    }

    One more thing, you will need to display the WordPress.com footer information. Hiding that attribution will put your site in violation of the Terms of Service.

    Please remove the following:

    .site-info {
        display: none
    }
  • Unknown's avatar

    Great stuff! Many thanks for your help.

    No problem, I have removed the offending code.

    Thanks
    Fred

  • Unknown's avatar
  • The topic ‘Center the main menu and also reduce menu padding.’ is closed to new replies.