Center Logo & Icons on Mobile Header

Center Logo & Icons on Mobile Header

LAL
Excursionist
12 0 6

Hello,  I had tried to  enlarged and center the mobile logo and expand the icons to the sides for more room. This is the current code used under theme settings CSS.  but as you can see it's still not centered. can anyone help? ride theme.  Thank you.

 

Domain: lovedandlavished.com

PW: test123

 

@media screen and (max-width: 768px){ header.header { padding-left: 10px !important; } summary.header__icon.header__icon--search > span { width: fit-content !important; } summary.header__icon.header__icon--search > span > span.svg-wrapper:nth-child(1) { width: unset !important; } summary.header__icon.header__icon--search { width: fit-content !important; } }

 

Screenshot_2025-04-17-23-06-18-17_40deb401b9ffe8e1df2f1cc5ba480b12 (1).jpg

 

Replies 8 (8)

TheUntechnickle
Shopify Partner
489 58 127

Hey @LAL,

 

I've reviewed your site and the current CSS you're using to center your logo on mobile. I can see why you're having trouble - the current approach needs a few adjustments to properly center the logo and space out the icons.

 

Here's a CSS solution that will center your logo and give your icons more breathing room:

 

@media screen and (max-width: 768px) {
  /* Improve header spacing */
  header.header {
    padding: 10px 15px !important;
    justify-content: space-between !important;
  }
  
  /* Center the logo */
  .header__heading {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
  }
  
  /* Make logo slightly larger */
  .header__heading-logo {
    max-width: 200px !important;
  }
  
  /* Ensure icons have proper spacing */
  .header__icons {
    margin-left: auto;
  }
  
  /* Adjust hamburger menu position */
  summary.header__icon--menu {
    margin-right: 10px;
  }
}

To implement this:

  1. Go to your Shopify admin
  2. Navigate to Online Store > Themes
  3. Click "Actions" and then "Edit code"
  4. Find your custom CSS file (or theme.css)
  5. Add the code above, replacing your current mobile header CSS

 

Let me know if you need any help implementing this or if you'd like any adjustments to the sizing!

Best regards,

Shubham | Untechnickle

Helping for free: hello@untechnickle.com


Don't forget to say thanks, it'll make my day - just send me an email! 


Get Revize for Free | Let your shoppers edit orders post-purchase | Get Zero Support Tickets | #1 Order Editing + Upsell App

LAL
Excursionist
12 0 6

sorry that did not work well, it made logo smaller and it was not responsive to screen sizes , I had two different views in two phones, one the logo overlapped the search icon. see pics. 😞 

Screenshot_20250417-235605_Chrome (1).png

 

Screenshot_2025-04-18-00-23-54-87_40deb401b9ffe8e1df2f1cc5ba480b12.jpg

 

Mustafa_Ali
Explorer
430 43 79
<style>
@media screen and (max-width: 767px) {
header.header.header--top-center.header--mobile-center.page-width.drawer-menu.header--has-menu.header--has-account {
    display: flex !important;
    justify-content: center !important;
 }
.header-wrapper.color-scheme-6eb00285-a6b5-4fcf-b72d-98981867c904.gradient {
    margin-left: 7px;
}
img.header__heading-logo.motion-reduce {
    margin-right: 32px;
 }
}
</style>

Mustafa_Ali_0-1744951393420.png

Go to online store ----> themes ----> go to three Dots ----> edit code ---->find theme.liquid files ----> place the code ---->
before the body ----->
if this code work please do not forget to like and mark it solution

 

LAL
Excursionist
12 0 6

thank you but sadly I didn't get the same results you did, logo was still very small,  only diff  was just more spaces next to the hambuger. 

Rahul_dhiman
Shopify Partner
830 156 174

Hello @LAL 
Go to online store ----> themes ----> actions ----> edit code ----> base.css
add this code at the end of the file and save.

@media screen and (max-width: 768px) {
.header {
padding: 0px !important;
}
}

result
108.png

If this was helpful, hit the like button and accept the solution.
Thanks

Want to modify or custom changes or bug fix on store . Or Need help with your store? Or -Want Complete Storefront

Contact here


BEST CUSTOMER ACCOUNTS APP WITH CUSTOM WISHLIST OPTION 
TRY OUR APP :

PWC: Customer Accounts & Pages

LAL
Excursionist
12 0 6

hi it works and looks beautiful but now the screen moves from left to right, right to left  and there's a scroll bar at the bottom for side to side  movement. 🙁

Made4uo-Ribe
Shopify Partner
10203 2423 3069

Hi @LAL 

Check this one. 

  1. From your Shopify admin dashboard, click on "Online Store" and then "Themes".
  2. Find the theme that you want to edit and click on "Actions" and then "Edit code".
  3. In the "Assets" folder, click on "base.css, style.css or theme.css" file, depending on which file your theme uses to store its CSS styles. At the bottom of the file, add the following CSS code:
@media screen and (max-width: 768px) {
    header.header {
        padding-right: 10px !important;
    }
    .header__icons {
        padding-right: 0;
    }
}
  • And Save.
  • Result:
  • Made4uoRibe_0-1744981419534.png

     

Please don't forget to Like and Mark Solution to the post that helped you. Thanks!

If this fixed your issue, Likes and Accept as Solution are highly appreciated. Coffee tips fuel my dedication.
Get experienced Shopify developers at affordable rates—visit Made4Uo.com for a quick quote!
Need THEME UPDATES but have custom codes? No worries, for an affordable price.
LAL
Excursionist
12 0 6

hi this one also works and looks beautiful but  the same thing happens, the screen moves from left to right, right to left  and there's a scroll bar at the bottom for side to side  movement.