- This topic has 14 replies, 3 voices, and was last updated 4 months, 4 weeks ago by
David.
-
AuthorPosts
-
October 19, 2022 at 4:03 am #2378513
Salty Communication
Hi!
I cant get my primary menu to get centered. I have gone through all the tricks I can find on the forum but I cant manage to get it work.
In the customizer -> layout -> primary menu I have no “Navigation Aligment”.I have set up mega menu with the help of the GP Documentation. Maybe that has something to do with it?
All the best!
-Johan
October 19, 2022 at 5:47 am #2378608David
StaffCustomer SupportHi there,
the Alignment option would only be visible if the Navigation Location is set to Before or After the header.
When its Floated to the right, Centering is very subjective and requires CSS.For example this CSS will center the navigation in the available space.
.nav-float-right #site-navigation { margin-right: auto; }
So you have:
Logo | equal space | Navigation | equal space
However if you want the navigation centered in the header, then you have to account for the logo takin up some space and add that same amount of space to the right of the nav
ie.
Logo | equal space | Navigation | equal space + logo width
.nav-float-right #site-navigation { margin-right: auto; } @media(min-width: 1240px { .nav-float-right #site-navigation { padding-right: 210px; } }
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/October 19, 2022 at 11:51 pm #2379581Salty Communication
Thanks David! I got the menu centered, but the padding doesnt seem to work. Maybe it has something to do with the CSS for the mega menu?
I got this code red as well in the customizer:
.nav-float-right #site-navigation {
As you can see on the page the buttons right to the menu is very close to the menu. I want some padding between those. I tried to add padding to the widget itself, but then the menu got pushed to the left as well.
October 20, 2022 at 12:29 am #2379607Fernando Customer Support
Hello there,
Can you update the code above to this?:
.nav-float-right #site-navigation { margin-right: auto; } @media(min-width: 1240px) { .nav-float-right #site-navigation { padding-right: 210px; } }
October 20, 2022 at 4:26 am #2379830Salty Communication
Hi!
Perfect. Now it is centered. However, I need the buttons to be more aligned to the right. Any clues how to fix that?October 20, 2022 at 5:49 am #2379903David
StaffCustomer SupportRemove all of that CSS and add this:
#site-navigation { flex: 1; } .main-navigation .menu-bar-items, .main-navigation .main-nav{ margin-left: auto; }
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/October 20, 2022 at 6:16 am #2379930Salty Communication
Perfect! It is now centered. The mega menu got pretty huge though. How do I size the mega-menu when hovering over the menu?
Is there a way to add a box shadow to the open mega-menu as well?October 20, 2022 at 6:29 am #2379948David
StaffCustomer SupportTry this CSS:
#primary-menu { position: relative; } nav .main-nav .mega-menu > ul { box-shadow: 0 9px 6px 3px rgba(0,0,0,0.2); }
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/October 21, 2022 at 12:05 am #2380757Salty Communication
Super David. Thanks!
-J
October 21, 2022 at 12:53 am #2380802Salty Communication
Sorry to open this one up again.
But how do I get the menu to get centered on the sticky menu as well on desktop?-J
October 21, 2022 at 1:52 am #2380852Fernando Customer Support
Hello there,
Can you re-share the link to the site in question?
October 21, 2022 at 5:40 am #2381034Salty Communication
Sure, sorry!
October 21, 2022 at 9:03 am #2381407David
StaffCustomer SupportChange this CSS:
.main-navigation .menu-bar-items, .main-navigation .main-nav{ margin-left: auto; }
to:
.main-navigation .menu-bar-items, .main-navigation .main-nav{ margin-left: auto !important; }
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/October 24, 2022 at 12:31 am #2383747Salty Communication
Perfect. Thanks!
October 24, 2022 at 3:05 am #2383886David
StaffCustomer SupportYou’re welcome
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.