Centering sub-menu

Hello,

the sub-menu items are not centered (i.e., not displayed exactly under the main menu). the sub-menus should be aligned center under the main menu.

Please help in resolving this.

Thank you.

Hi,

Please post a link to your website, so I can give you a working solution to center your sub-menu items.

Kind Regards,
Csaba

hi Csaba,
Pls check the site http://www.templebellsmedia.com/
there are sub-menus for main menu ‘Work’, but when we hover on this main menu the displayed sub-menus are not exactly center aligned below ‘Work’

Hi,

You can center align the sub-menu items with this Custom CSS:

#mainnav .sub-menu li a {
    text-align: center !important;
}

Please add the above CSS to your Child Theme’s style.css or in case you haven’t setup a Child Theme already, then you can also add the CSS to wp-admin -> Appearance -> Customizer -> Additional CSS so you won’t loose the changes after Theme or WordPress updates.

Please let me know how it works.

Kind Regards,
Csaba

Hi,

I tried with the above code, but unfortunately not working. Any other way you can suggest please.

Thank you.

Hi,

I don’t see the Custom CSS applied to your website, please add it to Customizer -> Additional CSS and make sure to don’t have anything else in that field, or if you have more Custom CSS there, then please add this one to the very first line, without breaking other CSS there.

Kind Regards,
Csaba

Hi, I added the code again. Please check. But unfortunately it is not working.

Hello Csaba,

Can you please check the issue and help me in resolving.

Thank you
Kiran

Hi,

Ok, I think I know what you mean, the CSS I gave you before was to center the menu text ( I thought you want to do that ), but you can center the sub-menu position too with this Custom CSS:

#mainnav .sub-menu {
    margin-left: -75% !important;
    left: 0 !important;
    right: 0 !important;
}

Please let me know how it works.

Kind Regards,
Csaba

hello Csaba,

Thank you very much. the code worked.

Best Regards,
Kiran

Hi,

Great! You’re most welcome! If you need help with anything else, please open a new topic.

Have a nice day!

Kind Regards,
Csaba