Site logo

Archived topic

alignment of menu element

16 replies · Started by Tim on November 22, 2022

Viewing posts 1–15 of 17

Hello, I have a menu element that I'd like to be justified left so that it aligns more properly next to the hamburger menu. How can I do this?

Also, when I added this element it really messed up the sticky menu. Can you help so that the sticky menu layout is the same as the main layout with just the red background?

Hi Tim,

What is the menu/header layout you are trying to achieve?

Everything on the left with the logo in the center?

This would make it very left heavy I think.

Let me know :)

I'd like Hamburger and weather element on the left, logo centered, and everything else (phone, how to find, book) on the right.

Hi Tim,

Thank you for clarifying. Let's first address where it's added so we can fix how it looks on all views properly.

How are you adding this Weather Widget? Is it a Block or a Shortcode. In any case, can you try adding it through a Block or Hook Element, and hook it to menu_bar_items.

Hook Element: https://docs.generatepress.com/article/hooks-element-overview/
Block Element: https://docs.generatepress.com/article/block-element-hook/

Let us know once you've done so, and we'll take a look.

It's with a block element and shortcode within that block. I had it as inside navigation but now just added it as Menu_bar_items

No. I want the weather to be to the right of the hamburger menu. Then everything mirror on the sticky nav.

Hi there,

how is the Weather element being generated ?
As the opening HTML is a naked DIV:


<div>
<div id="splw-location-weather-pro-5734" class="splw-main-wrapper" data-shortcode-id="5734" data-location="{&quot;autoLocation&quot;:&quot;&quot;}" data-custom-field="0">

It would be handy if that div wasn't there or had its own class that we could target.

It's using the weather location plugin.

1. Change this CSS:


.site-logo {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
}

to:


.navigation-branding,
.site-logo {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
}

2. Add this CSS to move the weather to the left, and remove the crazy amount of margins and padding it has lol


.inside-navigation div:not([class]) {
    margin-right: auto;
}
.inside-navigation #splw-location-weather-pro-5734.splw-main-wrapper,
.inside-navigation #splw-location-weather-pro-5734.splw-main-wrapper :is(.splw-pro-wrapper, .splw-pro-body, .splw-pro-header) {
    margin-bottom: 0;
    margin-top: 0;
    padding-bottom: 0;
    padding-top: 0;
}

Thank you! This is looking much better!

The weather is still to the left of the hamburger menu.

Also, the sticky menu has everything to the left of the logo. Can we mimic what it has for the main menu but just with the red background?

Now add this CSS:


.menu-bar-item {
    order: -1;
}
.menu-bar-items {
    margin-right: auto;
}

Looks great! Now whats the best way to hide the weather item on mobile?

You can try this:

#mobile-header .menu-bar-items > div:not([class]) {
    display: none;
}
This archived topic is closed to new replies.