Site logo

Archived topic

Centre Submenu

8 replies · Started by Ben Foo on January 7, 2019

Viewing posts 1–9 of 9

Hi,

My primary menu is to the right of the screen as I've set.
When i hover over one of the items on that menu to get a sub menu out, I realise that it is not centralized, in the centre of the screen?
How do i get the sub menu centralized?
Thank you.

Best Regards,
Ben Foo

Thanks for your help again.

Hi there,

so you have added CSS to make the Sub-menu horizontal, but i am not sure what you mean by centralizing it? do you have an image / example of how you want it to look?

Yes I have made the submenu horizontal.

Just that the words in the submenu are not in the center of the screen.
They are swayed to the left side.
Is there any CSS or ways to make the words in spread out so that they look center? (as in microsoft word - center, left or right).
Now I just want words in the submenu to be neat and spread out nicely throughout the width of the page, not skewed to one side like current one.
Thank you.

Best Regards,
Ben

So you have this CSS:

body .main-navigation ul.menu > li > ul {
    width: 100%;
    left: 0 !important;
}

Update it to:

body .main-navigation ul.menu > li > ul {
    width: 100%;
    left: 0 !important;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

Thanks.
It centers the submenu. But some of the words that are at the side of the submenu do not show fully.
Any solutions for that?
Thank you.

Best Regards,
Ben

i edited the code to include a flex wrap, this will stop the content from escaping the edge on small screens.

Thanks so much!

You're welcome

This archived topic is closed to new replies.