Taming the Horizon Theme: Fixing Misaligned Headers & Double Search Bars

Hey store owners! Ever found yourself staring at your Shopify store, scratching your head over something that just looks… off? Maybe your header menu is playing hide-and-seek, or your cart icon has decided to go on a solo adventure, completely misaligned with everything else. You’re not alone! I recently dove into a fascinating discussion on the Shopify community forums that perfectly illustrates these kinds of headaches, especially when dealing with custom code or newer themes like Horizon.

Our story starts with LiquorAssets, a store owner who was grappling with a few frustrating header issues on their Horizon theme. Specifically, they had:

  • Two search functions appearing on desktop, even when trying to disable one.
  • The quantity bubble and cart icon becoming misaligned after an item was added to the cart.

Mobile looked fine, which often adds to the mystery, right? You can check out their site at https://liquorassets.net/ to see what they were dealing with (though it’s likely fixed now!).

The Root Cause: A Missing Curly Brace and AI’s Double-Edged Sword

What made this thread so insightful was the expert diagnosis from community member tim_tairli. Turns out, LiquorAssets was new to coding and had been relying heavily on AI for scripting – a common practice these days! While AI can be a fantastic tool, it sometimes generates “messy and patchy code” as LiquorAssets put it, especially if you don’t quite understand what you’re pasting in.

Tim quickly pinpointed a critical error: a missing closing curly brace (}) in a media query within the snippets/collection-card.liquid file. This seemingly small oversight had a massive cascading effect. Think of it like a typo in a legal document – it can invalidate everything that follows! In CSS, an unclosed media query can cause subsequent styles (sometimes thousands of lines!) to be incorrectly nested or ignored, leading to widespread layout problems.

Here’s a snippet from Tim’s post showing the missing brace:

Screenshot 2026-06-16 at 12.00.42 AM

This led to absurd situations, like CSS rules being nested within two conflicting media queries, making them impossible to apply:

@media screen and (max-width: 749px) {
  @media screen and (min-width: 750px) {
    [data-menu-style='drawer'] .search-action--hidden-on-drawer {
      display: none;
    }

    [data-menu-style='menu'] .search-action--hidden-on-menu {
      display: none;
    }
  }
}

The “!important” Trap

Another key takeaway from Tim’s analysis was the problematic use of !important. While it might seem like a quick fix to override styles, it often complicates development, making debugging a nightmare and future updates incredibly difficult. Tim found rules like this in LiquorAssets’ code:

Screenshot 2026-06-16 at 12.08.55 AM

This kind of override was forcing both search buttons to show on desktop, despite other rules trying to hide them.

Immediate Fixes vs. Long-Term Solutions

Before Tim’s deep dive, other community members like mastroke and Dan-From-Ryviu offered some direct CSS snippets to address the symptoms. These are great for quick fixes if you know exactly what you need to target:

Option 1: mastroke’s Code

This code aims to hide the left search bar, align header icons, and correctly position the cart count bubble for desktop views:

@media screen and (min-width: 990px) {
  .header__search--left,
  .header .search-modal:first-of-type {
    display: none !important;
  }
  .header__icons {
    align-items: center;
  }
  .cart-count-bubble {
    position: absolute;
    top: -6px;
    right: -6px;
  }
}

Option 2: Dan-From-Ryviu’s Code

This offers a slightly different approach, also using !important for the search and cart bubble positioning:

.action__cart { position: relative; }
.header__column--left search-button { display: none !important; }
.cart-bubble { position: absolute !important; top: 0; right: 0; }

Screenshot 2026-06-16 at 09.40.34

While these snippets can work, Tim’s advice highlights a crucial point: it’s always better to fix the underlying structural issue first. Once LiquorAssets added the missing closing brace and removed the overriding !important code, their header issues largely resolved themselves, showing how proper code structure is key.

Your Action Plan: Fixing Your Horizon Theme Header

If you’re facing similar issues, here’s a step-by-step approach based on the community’s wisdom:

1. Backup Your Theme FIRST!

Seriously, don’t skip this! Before making ANY code changes, go to your Shopify Admin > Online Store > Themes. Find your current theme, click “Actions,” and select “Duplicate.” This creates a safe copy you can revert to if something goes wrong.

2. Locate and Fix Missing Curly Braces

This is the most critical step if you suspect structural CSS errors. Navigate to Online Store > Themes > Actions > Edit Code.

  • Look for files that contain custom CSS, especially within snippets/ or assets/. In LiquorAssets’ case, it was snippets/collection-card.liquid.
  • Scan for unclosed media queries (@media screen and (...) { without a matching }). This can be tricky, but look for sections where a media query seems to start but never properly ends, causing subsequent code to be nested incorrectly.
  • Add the missing } where appropriate. This might take some careful inspection or using a code editor with syntax highlighting to spot errors.

3. Audit and Remove Problematic “!important” Overrides

After fixing structural errors, review any custom CSS you’ve added that uses !important. If the issue is resolved without it, remove it! If not, try to find a more specific selector to achieve your desired style without resorting to !important.

4. Implement Specific CSS Fixes (If Still Needed)

If, after fixing the root structural issues, you still have minor alignment or display problems, you can use targeted CSS. Tim advises against putting custom CSS directly into core theme files like base.css. Instead, use:

  • Theme settings > Custom CSS: This is the cleanest place for small, custom snippets.
  • A separate stylesheet (e.g., custom.css): Create a new asset file (e.g., assets/custom.css) and link it in your theme.liquid file. This helps keep your changes organized and makes future theme updates easier.

Here are the codes again, if you need them:

For Search & Cart Alignment (mastroke's suggestion):

@media screen and (min-width: 990px) {
  .header__search--left,
  .header .search-modal:first-of-type {
    display: none !important;
  }
  .header__icons {
    align-items: center;
  }
  .cart-count-bubble {
    position: absolute;
    top: -6px;
    right: -6px;
  }
}

Alternative Cart & Search Hiding (Dan-From-Ryviu's suggestion):

.action__cart { position: relative; }
.header__column--left search-button { display: none !important; }
.cart-bubble { position: absolute !important; top: 0; right: 0; }

Learning from the Community

This whole discussion really highlights a few important lessons for us store owners. First, while AI is an incredible assistant, it’s crucial to understand the code it generates, especially when it comes to fundamental structure like CSS. Asking AI to explain its code, as Tim suggested, is a smart move. Second, the Shopify community is an invaluable resource – real people sharing real solutions and best practices. And finally, when you’re diving into code, a small error can have a huge ripple effect, so taking the time to understand your theme’s architecture (even if a bit complex like Horizon) will save you a lot of headaches down the line. Good luck making your headers pixel-perfect!

Share:

Use cases

Explore use cases

Agencies, store owners, enterprise — find the migration path that fits.

Explore use cases