Banish That Pesky Horizontal Scrollbar on Your Shopify Horizon Theme

Hey fellow store owners! There’s nothing quite as frustrating as landing on a beautifully designed page, only to find a rogue horizontal scrollbar messing up the whole experience. It’s a common hiccup, and it recently popped up in a community discussion where a store owner, @TCC_2025, was dealing with this exact issue on their Horizon theme store, specifically on a 'custom bags' page. They needed an urgent fix, and the community really came through with some fantastic insights!

The Dreaded Horizontal Scrollbar: Why It Happens

So, why does this even happen? As @Josh-FiveAcreCode and @adwaizer pointed out in the thread, a horizontal scrollbar almost always means one thing: an element on your page is wider than the screen. This often comes down to a few culprits:

  • Full-bleed sections: You might have a section designed to stretch edge-to-edge (width: 100vw), but it's not playing nicely with your page's overall layout, especially if a vertical scrollbar is present.
  • Fixed-width elements: Sometimes, an image, video, or embed block has a fixed pixel width that's just too big for smaller screens.
  • Custom Liquid or App Blocks: Custom code or third-party app sections can sometimes introduce elements that break out of their containers.

Hiding the scrollbar is a quick fix, but understanding the root cause is always better, as simply hiding it can sometimes clip content on mobile devices without you realizing it. Let's dive into how to tackle this.

First, The Best Fix: Find the Culprit!

Before you hide anything, the ideal approach is to find the element that's causing the overflow and adjust its width. @adwaizer shared a super handy trick for this:

  1. Open the problematic page in your browser.
  2. Right-click anywhere on the page and select 'Inspect' (or 'Inspect Element'). This opens your browser's developer console.
  3. Go to the 'Console' tab.
  4. Paste this JavaScript code and press Enter:
[...document.querySelectorAll('body *')].filter(el => el.getBoundingClientRect().right > document.documentElement.clientWidth + 1).map(el => el.tagName + '.' + [...el.classList].join('.'))

This little snippet will list the HTML elements that are sticking out beyond the right edge of your screen. Look for things like DIV.custom-liquid or specific carousel classes. Once you identify the culprit, you can often fix it by editing that section's settings in the theme editor, or by adding CSS like max-width: 100%; to that specific element to ensure it never exceeds its parent's width.

A Quick & Safe Page-Specific Solution (No More Scrolling Sideways!)

If you need a faster solution, or if finding the exact culprit proves tricky, the community highlighted a great page-specific CSS fix. This is perfect for when you only want to affect one particular page, just like @TCC_2025 needed. Both @Ploqo and @rajimulislamjoy suggested variations of this method, and it's quite effective.

Here’s how you can implement it, using the steps and visuals shared by @Ploqo:

  1. Go to your Shopify Admin and navigate to Online Store > Themes.
  2. Find your current theme (Horizon, in this case) and click Customize.
  3. At the top of the theme editor, you'll see a dropdown that usually says 'Home page'. Click on this dropdown and navigate to the specific page that has the horizontal scrollbar issue (e.g., 'Pages' then select your 'Custom Bags' page).

  4. Once you're on the correct page's template in the editor, click 'Add section' on the left sidebar.
  5. Search for and select 'Custom Liquid'.

  6. In the Liquid box, paste the following code:

  1. Click Save in the top right corner.

Because you added this 'Custom Liquid' section to a specific page's template, the CSS within it will only apply when that page is loaded, ensuring your other store pages remain unaffected. This is a neat trick for isolated fixes!

Why 'Clip' is Better Than 'Hidden'

You might notice the code uses overflow-x: clip; instead of overflow-x: hidden;. @adwaizer wisely pointed out that clip is generally safer. While hidden just hides content that overflows, clip prevents it from being scrollable, but crucially, it doesn't interfere with sticky headers or other position-fixed elements on your page, which hidden sometimes can.

What if it's a specific component, like a carousel?

The solution above includes a specific rule for [class*="ai-carousel-container"]. This is a great example of targeting a specific element that might be causing the issue. If you know a particular section, like a product carousel or image gallery, is the problem, adding max-width: 100%; overflow: hidden; directly to its CSS class can often resolve it. @devcoders also suggested a similar targeted approach by adding CSS to your base.css file, though that would be a global change rather than page-specific.

Ultimately, a smooth user experience is paramount for any online store. Nobody likes unexpected scrolling! By understanding the causes and having these practical solutions in your toolkit, you can keep your Shopify store looking sharp and professional. Always remember to test your changes thoroughly, especially on different devices, to ensure everything looks perfect. If you're just starting your journey to build an amazing online store, remember that a strong foundation on Shopify can make all the difference, giving you the tools to create a seamless shopping experience for your customers.

Share:

Start with the tools

Explore migration tools

See options, compare methods, and pick the path that fits your store.

Explore migration tools