-
YEAR93
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. -
YEAR93
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.
Sotop
=20
would have placed inside the padded area, the extra 2px would have been Yings eye for detail 🙂 -
YEAR93
Thank you!
-
You’re welcome
-
YEAR93
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
-
YEAR93
Perfect, that did the job. Thank you!
-
Glad to hear that
- You must be logged in to reply to this topic.