Fine-Tuning Your Shopify Header: Mastering Social Icon Spacing and Placement

Hey everyone, your friendly neighborhood Shopify expert here! You know, sometimes it's the little things that make the biggest difference in how polished and professional your online store looks. We spend so much time on product pages and marketing, but the small details in your theme's design can really elevate the user experience. That's why I love diving into the Shopify Community forums – there's always someone asking a question that unlocks a gem of wisdom for everyone.

Recently, I stumbled upon a fantastic thread where a store owner, Geronim0, was wrestling with their social media icons in the header of their Horizon theme. They had successfully added custom social icons using a Liquid snippet called header-social.liquid, which is awesome! But, as often happens with custom code, they hit a snag: the icons had a bit too much space between them, and trying to adjust the gap attribute wasn't quite doing the trick below a certain pixel threshold. Sound familiar?

Screenshot 2026-11-22 at 18.28.23

Geronim0 shared their code, which was super helpful. Here's a snippet of what they were working with in their header-social.liquid file, particularly the CSS:

.cz-header-social {

display: flex !important;

align-items: center;

justify-content: flex-start;

gap: 2px !important;
	}



.cz-header-social > a {

margin: 0 !important;

padding: 0 !important;

}



.cz-header-social a {

display: inline-flex;

align-items: center;

justify-content: left;

width: 44px;

height: 44px;

color: inherit;

text-decoration: none;
	}



.cz-header-social svg {

display: block;

width: 20px;

height: 20px;
	}



.cz-header-social a:hover {

opacity: 0.7;
	}



.cz-header-social a:focus-visible {

outline: 2px solid currentColor;

outline-offset: 2px;

border-radius: 4px;
	}



@media screen and (max-width: 1023px) {

.cz-header-social {

display: none;
	}

}

The core of the issue wasn't just the gap property, but rather the individual width of each social icon link, set to 44px. This width was creating extra space around each icon, making them appear further apart than desired.

Reducing the Gap Between Social Icons

Thankfully, a community hero, PinFlow, jumped in with a super straightforward fix. The key was to adjust the width property of the social icon links themselves. Here's how they suggested Geronim0 could get those icons nice and snug:

Before and after: icons in the header

  1. In your Shopify admin, navigate to Online Store, then Themes.
  2. Find your Horizon theme (or whichever theme you're using for these icons), click the three dots ..., and select Edit code.
  3. Expand the Snippets folder and open header-social.liquid. This is where Geronim0 had placed their custom icon code.
  4. Press Ctrl+F (or Cmd+F on Mac) to search for width: 44px. You'll find it inside the .cz-header-social a block.

Snippets, header-social.liquid

The width line

  1. Change 44px to 24px (or any smaller value that looks good to you).
  2. Click Save.

Changed to 24px and Save

Boom! Just like that, the icons snap closer together. PinFlow wisely noted that you can experiment with smaller or larger numbers to get the exact spacing you want. It's all about finding that sweet spot for your design.

Centering Your Social Icons in the Header

Once the spacing was sorted, Geronim0 had another excellent question: how to get those icons perfectly centered between the "Contact" link and the search icon. This is a common design goal – symmetry and balance are key for a professional look!

Before and after: icons in the middle

PinFlow, always ready with a solution, provided another simple line of CSS to achieve this:

  1. Open your header-social.liquid file again (if you closed it).
  2. Find the .cz-header-social { block. It's usually the first CSS block under the