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:
- 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.
- Locate
theme.liquid: In the left-hand sidebar, under the “Layout” directory, click on thetheme.liquidfile. This is the main layout file for your entire store, controlling what loads on every page. - Add the CSS Snippet: Scroll all the way down to the bottom of the
theme.liquidfile. You’re looking for the closing
