- This topic has 27 replies, 4 voices, and was last updated 4 years, 10 months ago by
Leo.
-
AuthorPosts
-
January 22, 2021 at 3:49 am #1629062
Charbel
Many Thanks @David!!!
All the best,
January 22, 2021 at 5:51 am #1629170David
StaffCustomer SupportGlad we could be of help
June 16, 2021 at 11:56 pm #1824946Charbel
Hello @David,
Hope you are doing well.
I want to come back to this ticket, please.
I have changed my Mobile Menu Text and I have lost the center of the text label.
This was the previous code that you shared but is not working anymore with the new text.
I need to keep the hamburger icon on the left while the text centered.
Could you please help?@media(max-width: 768px) { .main-navigation.has-menu-bar-items button.menu-toggle { display: flex; flex-grow: 1; } button.menu-toggle .gp-icon { margin-right: auto; } .menu-toggle .gp-icon+.mobile-menu { margin-left: auto; margin-right: auto; } }Site: https://charbelnemnom.com
P.S. Additionally, I changed the icon type under General from SVG to Font as described here to improve performance: https://wordpress.ezoic.com/generatepress-ezoic-leap/ because Ezoic Leap is an accelerating tool and will cause performance degradation if we keep it to SVG.
Thank You @David!
June 17, 2021 at 11:12 am #1825776Leo
StaffCustomer SupportAre you trying to have both the toggle and text in the center or just the text?
June 17, 2021 at 11:41 am #1825787Charbel
Thank you @Leo for your support!
No, I want to keep the toggle (hamburger) icon on the left and only the text centered, please.
I have removed the CSS code share above because it’s not working anymore.
Thanks!
June 17, 2021 at 1:45 pm #1825868Leo
StaffCustomer SupportTry this:
@media (max-width: 768px) { .menu-toggle .mobile-menu { position: absolute; left: 50%; transform: translateX(-50%); } }June 17, 2021 at 11:39 pm #1826116Charbel
Thank You @Leo,
It’s working on some mobile devices with big screens.
However, if you have a small screen (e.g. First-generation iPhone X), the second word is coming on a new line and not readable.
As you can see, the Title is set to (Cloud & CyberSecurity). The word CyberSecurity is coming on a new line.You can see it if you run Google PSI for mobile here: https://developers.google.com/speed/pagespeed/insights/?url=https%3A%2F%2Fcharbelnemnom.com%2Fdeploy-azure-network-address-translation-nat-gateway%2F&tab=mobile
Please advise?
Many Thanks!
June 18, 2021 at 4:55 am #1826368Charbel
Hello @Leo,
I played with the percentage to try and center it for small mobile devices.
I used this CSS code:@media (max-width: 768px) { .menu-toggle .mobile-menu { position: absolute; left: 40%; transform: translateX(-30%); } }What do you think?
On large mobile devices, the text is still aligned more on the left-hand side. Can we center it across all mobile screens size?Thanks!
June 18, 2021 at 9:00 am #1826731Leo
StaffCustomer SupportHowever, if you have a small screen (e.g. First-generation iPhone X), the second word is coming on a new line and not readable.
iPhoneX seems to work fine when I use the mobile simulator:
https://www.screencast.com/t/a4HDBAQ3qDKQThat issue simply means there isn’t enough room for all the content to fit in one line.
The only solution is to reduce the text size by adding something like
font-size: 11px;to your CSS.June 18, 2021 at 9:11 am #1826751Charbel
Thank you @Leao,
Is the full CSS code below correct now? I have added the
font-size.
@media (max-width: 768px) {
.menu-toggle .mobile-menu {
position: absolute;
left: 40%;
transform: translateX(-30%);
font-size: 11px;
}
}Thanks!
June 18, 2021 at 10:06 am #1826829Leo
StaffCustomer SupportYup that looks good.
June 18, 2021 at 11:59 am #1826938Charbel
Thank You @Leo for your guidance on tackling this issue.
All the best,
June 18, 2021 at 12:03 pm #1826944Leo
StaffCustomer SupportNo problem 🙂
-
AuthorPosts
- The topic ‘How to center the text label for Mobile Menu?’ is closed to new replies.