Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

Centering Logo mobile header

  • Hello,

    I would like to center my logo in the header on mobile using custom CSS:

    	.site-logo  {
    		position: absolute;
    		left: 50%;
    		transform: translateX(-50%);
    		margin-left: auto;
    	}

    Everything appears correctly until the mobile dropdown menu is opened; at that point, the logo becomes misaligned. Please see the attached screenshot for reference. How can I resolve this?

  • Hi there,

    You didn’t define a top value.

    Add top:22px; to your css.

  • Thank you. How did you calculate the top value? In case I’m changing to logo or it’s size in the future.

  • Hi there,

    most likely by eye.

    Had the top = 0 the logo would have aligned to the very top of the header, which has 20px of padding.
    So top = 20 would have placed inside the padded area, the extra 2px would have been Yings eye for detail 🙂

  • Thank you!

  • You’re welcome

  • I noticed one more thing. After centering the logo with custom CSS (tablet and mobile view), the logo has become harder to click. I’m not sure why, but it seems the clickable area of the logo has shrunk, making it unresponsive at times. Do you know what might be causing this?

  • Try adding this additional CSS:

    
    .site-logo {
        z-index: 1000;
    }
    

    It will make sure the logo sits in front of the navigation

  • Perfect, that did the job. Thank you!

  • Glad to hear that

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.