- This topic has 8 replies, 2 voices, and was last updated 2 years, 4 months ago by Ying.
-
AuthorPosts
-
December 7, 2021 at 3:39 pm #2041786wickedonline
Hi,
I am trying to center the logo in the header of our site but it’s not working correctly.
The first issue is that when you make the browser window width shorter in desktop the header doesn’t look correct.The navigation items go on top of the logo.
The second issue is that when you enlarge the screen on a large monitor, the logo moves to the right and goes over the right navigation items.
December 7, 2021 at 3:40 pm #2041788wickedonlineHere is the code I am using:
@media(min-width: 769px) {
.inside-header>.site-branding,
.inside-header>.navigation-branding,
.inside-header>.site-logo,
.site-branding-container,
#site-navigation .navigation-branding .site-logo,
#sticky-navigation .navigation-branding {
position: absolute;
left: 50%;
transform: translateX(-50%);
z-index: 1000;
}#site-navigation {
margin-left: unset !important;
display: flex;
}.site-header .main-navigation:not(#sticky-navigation) .inside-navigation {
margin: unset;
}#site-navigation,
#primary-menu,
.main-navigation .inside-navigation {
flex: 1;
}/* Change nth-child(#) to first item to right */
.main-navigation ul li:nth-child(4) {
margin-left: auto;
}
}December 7, 2021 at 4:00 pm #2041804YingStaffCustomer SupportHi there,
Can you go to customizer > layout > Primary navigation:
1. setnavigation location
tobelow header
.
2. setInner Navigation Width
toFull
.
3. setnavigation location
back tofloat right
.Let me know ๐
December 7, 2021 at 4:34 pm #2041827wickedonlineHi that fixed the second issue but still have issues when you make the browser window smaller. Would it be the mobile breakpoint setting?
December 7, 2021 at 4:51 pm #2041837YingStaffCustomer SupportYou mean something like this?
https://www.screencast.com/t/AaSiHNguy4KIf so, the logo doesn’t move, there’s just not enough space for everything in the header at this width.
You can try set t a higher mobile breaking point, eg.
970
instead of768
https://docs.generatepress.com/article/primary-navigation-layout-overview/December 7, 2021 at 4:53 pm #2041838wickedonlinePerfect! That worked! The only thing remaining is the padding on the left and right of the sticky header. When we made these changes, the navigation items on the sticky header are all the way to the left and all the way to the right.
December 7, 2021 at 5:02 pm #2041841YingStaffCustomer SupportTry adding this CSS:
@media (min-width: 971px) { #sticky-navigation .inside-navigation { padding: 0 64px 0 64px; } }
December 7, 2021 at 5:03 pm #2041842wickedonlineThat worked perfectly. Thank you!!
December 7, 2021 at 5:09 pm #2041844YingStaffCustomer SupportYou are welcome ๐
-
AuthorPosts
- You must be logged in to reply to this topic.