Shrink Those Pesky Mobile Gaps in Your Shopify Dawn Theme Image Banners

Hey everyone! As a Shopify expert who spends a lot of time digging through community discussions, I often see recurring themes. One common head-scratcher that popped up recently, thanks to a great question from Tammy_29, was about those stubborn gaps in image banners on mobile. You know the ones – you've set your padding to zero, but there are still these annoying spaces between your banner image, text, and call-to-action button, especially on phones.

Tammy shared an image of her Dawn theme banner on mobile, showing exactly this issue. Despite setting the padding to 0, she noticed a significant gap between the image and the text, and another one between the text and the button label. It's a classic responsive design challenge, and it really highlights how important it is to fine-tune your mobile experience. After all, most of your customers are probably browsing on their phones!

Why "Padding: 0" Isn't Always Enough

It's easy to assume that if you set a section's padding to zero, everything inside will just snuggle up. But as Milomir (ten12star) hinted in the thread, sometimes these gaps come from "inner padding" or margins on specific elements within the banner itself, not the main section. Themes like Dawn are built with a lot of default spacing to look good out-of-the-box, but this can sometimes work against your specific design choices, especially when images are sized differently.

The good news is, the community came through with some fantastic, actionable solutions. Let's break down the best approaches.

Solution 1: Targeted Custom CSS in Your Theme Editor (The Easy Way)

Ploqo offered a super clean and straightforward method that I often recommend because it keeps your changes contained and doesn't mess with core theme files. This approach uses the "Custom CSS" feature available for individual sections within the Shopify theme editor. It specifically targets mobile views, so your desktop layout remains untouched.

Step-by-Step Guide for Dawn Theme:

  1. From your Shopify admin, go to Online Store > Themes.
  2. Find your current theme (likely Dawn) and click on Customize (or Edit theme as Ploqo mentioned, which leads to the customizer).
    Online Store, Themes, Edit theme
  3. In the left sidebar of the theme editor, click on the Image banner section you want to adjust.
    Image banner in the sidebar
  4. Scroll all the way down the settings for that section until you find and expand Custom CSS.
    Custom CSS at the bottom of the section
  5. Paste the following code into the Custom CSS box:
    @media screen and (max-width: 749px) {
      .banner__box {
        padding-top: 1rem;
        padding-bottom: 1.5rem;
      }
    }
    
    Code pasted in Custom CSS
  6. Click Save.
    Save button

This code specifically targets the .banner__box class (which is often responsible for the content area within your banner) and adjusts its top and bottom padding. The @media screen and (max-width: 749px) part ensures these changes only apply to screens 749 pixels wide or smaller, effectively targeting mobile devices. You can tweak 1rem (gap above content) and 1.5rem (gap below content/button) to values like 0.5rem or even 0 if you want it super tight.

Here's a visual of the kind of improvement you can expect on mobile:
Before and after on mobile

Solution 2: More Comprehensive CSS in theme.liquid (For Deeper Control)

Mustafa_Ali provided another excellent solution that offers a bit more control by targeting both .banner__box and .banner__content. This method involves editing your theme's core files, specifically theme.liquid. While effective, always remember to duplicate your theme before making any direct code edits!

Step-by-Step Guide for Dawn Theme:

  1. From your Shopify admin, go to Online Store > Themes.
  2. Find your current theme, click the "..." (three dots) button, and select Edit code.
  3. In the left sidebar, find and click on theme.liquid under the "Layout" directory.
  4. Scroll down to the very bottom of the file, just before the tag.
  5. Paste the following code:
    
    
  6. Click Save.

This code adds inline CSS to your theme, specifically for mobile. It uses !important to ensure these styles override any conflicting default styles. You can adjust the 1rem values for .banner__box to make those top and bottom gaps even tighter. The inclusion of .banner__content with padding: 0 !important is a great way to aggressively remove any internal padding within the content block itself.

Choosing Your Approach and Further Tweaks

For most store owners, Ploqo's method (using the Custom CSS box within the theme editor) is the safest and easiest because it limits the scope of your changes to a specific section and avoids direct theme file modification. However, if you find that still isn't quite enough, Mustafa's approach in theme.liquid offers a more global override.

Remember, responsive design can be tricky. If these solutions don't quite hit the mark, Milomir's advice to use your browser's "Inspect" tool is golden. Right-click on the gap in your mobile preview or browser, choose "Inspect," and look for the specific CSS classes or elements that are generating the unwanted space. You might find other classes like .banner__image-wrapper or specific headings (h1, h2) or paragraphs (p) that have their own default margins or padding you need to override.

Also, double-check your banner section's settings in the theme editor for any "mobile height" options. Sometimes a fixed height setting can introduce empty space even if your padding is zeroed out. Experimenting with your image size and aspect ratio can also make a big difference in how the banner content flows on smaller screens.

Ultimately, getting your mobile design just right often involves a bit of trial and error with CSS. But with these community-tested methods, you're well on your way to creating a seamless and professional-looking image banner experience for all your mobile shoppers. Happy customizing!

Share:

Use cases

Explore use cases

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

Explore use cases