Shopify Image Banner Text Box: Fix Wrapping & Eliminate FOUC for Optimal Display

Hey everyone! As someone who spends a lot of time diving into the Shopify community forums, I often see common pain points that store owners run into, especially when they're trying to make their site look just right. One recent thread caught my eye because it tackled a super common design snag: getting your Image Banner text to behave on different screen sizes. You know, that moment when a perfectly crafted headline breaks into an awkward second line on a desktop?

That's exactly what our friend atmos-art was dealing with. They had a great headline, “Abstract Photography Workshops,” for their Atmos Art page, but on larger screens, it was stubbornly wrapping, messing with the clean look of their Image Banner section.

The Initial Fixes & The Annoying “Flash”

Like many of you, atmos-art first turned to the community for help, asking how to adjust the text box aspect of their Image Banner. Immediately, a couple of helpful folks, umerzaman152 and Moeed, jumped in with very similar solutions. Both suggested adding some custom CSS directly into the Image Banner section’s “Custom CSS” option within the theme editor. This is a common and often effective way to make quick styling tweaks without diving too deep into your theme files.

Here’s what umerzaman152 suggested, specifically for Dawn-based themes:

@media screen and (min-width: 990px) {
  .banner__box {
    max-width: 100%!important;
  }
}

Moeed offered a similar snippet, targeting a slightly different class and a lower minimum screen width:

@media screen and (min-width: 768px) {
.banner__box.gradient {
    max-width: 100% !important;
}
}

Both pieces of code essentially tell the browser: “On screens wider than X pixels, make sure that banner text box stretches to 100% of its available width, no matter what!” The !important flag is a CSS declaration that ensures this style overrides any other conflicting styles.

atmos-art tried one of these, and it “seemed to work,” which is great, right? But then came the kicker – a problem many of us have encountered: the dreaded “flash of unstyled content,” or FOUC. atmos-art described it perfectly: “when my page loads. It quickly loads the previous size of the image banner then shifts to the smaller one. Is there a way to make the new size load from the beginning by default?” This is super frustrating for user experience, making your site feel a bit clunky and unprofessional.

The “Aha!” Moment: Embedding CSS for a Seamless Load

This is where Moeed came back with the refined solution, tackling the FOUC head-on. The reason for the flash is that when you add custom CSS directly to a section in the theme editor, that CSS often loads a little later in the page rendering process. The browser first paints the page with the default styles, and then applies your custom CSS, causing that visible shift.

The fix? Get that CSS to load as early as possible! Moeed’s brilliant suggestion was to embed the CSS directly into your theme’s core `theme.liquid` file. This way, the browser encounters and applies the custom styles right from the start, before anything else has a chance to render with the old styles. It’s a subtle but powerful change that makes all the difference.

Step-by-Step: Fixing Your Image Banner Text Wrapping (and FOUC!)

If you’re facing a similar issue with your Image Banner text or any other section that’s giving you FOUC, here’s how to implement the community-approved fix:

  1. Access Your Theme Code: From your Shopify admin, go to Online Store > Themes. Find the theme you want to edit (ideally, duplicate your live theme first so you can experiment safely!) and click Actions > Edit Code.
  2. Locate theme.liquid: In the left-hand sidebar, under the “Layout” directory, click on the theme.liquid file. This is the main layout file for your entire store, controlling what loads on every page.
  3. Add the CSS Snippet: Scroll all the way down to the bottom of the theme.liquid file. You’re looking for the closing tag. Just above this tag, paste the following code:

A Quick Note on the Code:

  • @media screen and (min-width: 768px): This part ensures your change only applies to screens that are 768 pixels wide or larger (typically tablets and desktops). On smaller screens, the default wrapping behavior will remain, which is usually desired for mobile readability.
  • .banner__box.gradient: This is the specific CSS class that targets the text box within the Image Banner. Moeed used this, and it worked for atmos-art. If for some reason this doesn’t work for your specific theme/setup, you might try .banner__box (as umerzaman152 suggested) or inspect your page with developer tools to find the exact class for your text container.
  • max-width: 100% !important;: This is the core of the fix, telling the text box to expand to its full available width.
  1. Save Your Changes: Click the “Save” button in the top right corner of the code editor.
  2. Check Your Store: Visit your live store and check the page with the Image Banner. You should now see the text box load correctly from the start, with no awkward line breaks or flashing!

Moeed even shared a screenshot of the “RESULT” in the thread, showing the beautifully unwrapped text:

image

And sure enough, atmos-art confirmed, “This works great. Thank you!” – which is exactly what we love to see in the community!

A Few Thoughts on Customizing Your Theme

This little fix highlights a couple of important lessons. First, the Shopify community is an incredible resource for troubleshooting and finding creative solutions. Second, sometimes the best solution isn’t the most obvious one, and it often involves understanding how browsers render content. And finally, always remember to duplicate your theme before making any code edits! It’s your safety net in case something goes awry.

Customizing your Shopify store can feel a bit daunting at first, but with a little CSS and some guidance from the community, you can really make your brand shine. If you're just starting your journey or looking to switch to a more robust platform that offers this level of customization and a vibrant support community, consider checking out Shopify to build your dream store. It’s amazing what you can achieve when you roll up your sleeves and leverage the power of the platform and its incredible network of merchants and experts.

Share:

Start with the tools

Explore migration tools

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

Explore migration tools