Taming the Horizon Theme: Your Guide to Fixing Mobile Horizontal Scroll
Hey there, fellow store owners! Let's talk about something that can really throw a wrench in your mobile shopping experience: that annoying horizontal scroll. You know the one – you're scrolling down a page on your phone, and suddenly you can scroll left and right too, revealing empty space or, worse, chopped-off content. It's a classic head-scratcher, and it recently came up in our Shopify community with a user, @siva_fds, who was wrestling with this exact issue on their Horizon theme.
Siva was seeing this horizontal scroll specifically on mobile, and it was making their store look less than polished. They even shared a screenshot, which is always super helpful for the community to diagnose:

It's a common dilemma: you want your store to look perfect on every device, and a horizontal scroll on mobile just screams 'unfinished.' So, let's dive into what the community suggested and, more importantly, the best way to tackle this.
The Quick Fix vs. The Smart Fix: What We Learned
Initially, some community members like @Wsp and @devcoders offered what seems like a straightforward solution: adding overflow-x: hidden; to the html, body elements. Here's a version of that code snippet:
@media screen and (max-width: 749px) {
html,
body {
width: 100%;
overflow-x: hidden;
}
}

This code, usually placed at the bottom of your theme.css or base.css file, tells the browser to simply hide any content that overflows horizontally on screens smaller than 749px (or 768px, depending on the breakpoint). It's tempting, right? Like putting a band-aid on a leaky pipe.
However, our sharp-eyed community member @tim_1 swooped in with a crucial warning: "Do not do this – it will break your sticky header." And they're absolutely right! Applying overflow-x: hidden; globally to html, body can have unintended side effects, especially with elements that rely on the main document flow, like sticky headers or certain animations.
Siva also tried a more targeted approach from @mastroke, which involved hiding overflow on a specific section using a class like .section.section--page-width.color-scheme-af981dc4-3b00-4875-844e-6806dda2415e. While a more specific target is good, Siva reported that it didn't fully resolve their issue, and those color-scheme-xxxx classes are often dynamically generated and unique to your theme's settings, making them less reliable for a general fix.

The Root Cause & The Best Solution
This is where tim_1's expertise really shone. They pinpointed the actual culprit: a section with 'hotspots' where a popup was extending beyond the right border of the screen on mobile. This kind of element, often from an app or a custom section, is what truly causes the horizontal scroll – it's literally wider than its container!

The best approach isn't just to hide the scroll, but to fix the element that's causing it. Here's how to do it, combining tim_1's brilliant insights:
Step-by-Step Fix for Horizon Theme Horizontal Scroll
This method focuses on targeting the specific problematic section and element, which is the gold standard for clean, maintainable code.
- Identify the Problematic Section:
- Go to your Shopify Admin > Online Store > Themes.
- Click 'Customize' on your Horizon theme.
- Navigate to the page where you see the horizontal scroll.
- Use your browser's developer tools (right-click > 'Inspect' on desktop, or connect your mobile device for remote debugging) to find the section that contains the overflowing element (e.g., an image with hotspots, a wide product grid, etc.). Look for elements that extend beyond the screen's visible width.
- Apply
overflow: hidden;to the Specific Section:- Once you've identified the section, click on it in the Theme Customizer.
- Look for a 'Custom CSS' field, usually at the bottom of the section's settings.
- Paste this code into that custom CSS box:
{ overflow:hidden; } - This tells only that section to hide any overflowing content, without affecting your entire site or crucial elements like your sticky header.
- Reposition the Offending Element (if applicable):
- In Siva's case, the issue was a popup within a hotspot section. If your issue is similar (an element like a popup or tooltip extending too far), you might need to reposition it.
- You'll likely need to add this code to your
theme.css,base.css, or a custom CSS file in your theme's code editor (Online Store > Themes > Actions > Edit Code). Find theAssetsfolder and opentheme.cssorbase.css. - Paste this code, or a variation of it tailored to your specific element, at the bottom of the file:
[class*=ai-hotspot-wrapper]> div:last-child > [class*=ai-hotspot-popup] { transform: translateX(-65%); } - The
transform: translateX(-65%);part shifts the popup 65% to the left, bringing it back into view. You might need to adjust the percentage based on your specific element.
After applying these specific fixes, the problematic element should be neatly contained within its section, and the horizontal scroll should vanish. Here's what the 'after' looked like in tim_1's example:

Why This Approach is Better
The key takeaway here is to always aim for the most targeted solution possible. While a global overflow-x: hidden; might seem like a quick win, it often masks the underlying problem and can introduce new issues. By identifying the specific element causing the overflow and addressing it directly, you ensure a cleaner, more robust, and future-proof fix for your Horizon theme.
It's all about digging a little deeper than the surface. So, next time you spot that unwelcome horizontal scroll, remember to put on your detective hat, inspect your elements, and apply a precise fix. Your mobile shoppers (and your sticky header!) will thank you for it!