Taming Your Shopify Headings: How to Fix Stubborn H2 Font Sizes on Mobile
Hey everyone! Ever banged your head against a wall trying to get a simple CSS change to stick on your Shopify store? You're not alone. I recently dove into a really common, yet frustrating, issue on the Shopify community forums where a store owner, Mazzah, was tearing their hair out trying to adjust the H2 font size specifically for mobile devices on their Dwell theme. It's a classic example of how tricky custom CSS can be, even for seemingly small tweaks. But thanks to some fantastic community input, we can break down exactly what went wrong and how to fix it, not just for Mazzah, but for anyone facing similar styling headaches.
Mazzah's initial code looked something like this:
@media only screen and (max-width: 768px) {
.h2 {
font-size: 22px !important;
}
}
Seems reasonable, right? You want to target H2s on mobile, set a font size, and use !important to make sure it overrides. But it just wasn't working. So, what was the puzzle?
The Core Culprit: Understanding CSS Selectors
This was the very first thing several community members, like Priyasha, devcoders, and ashinxavier, jumped on. The main issue? The dot! In CSS, As Titan from Shopplaza brilliantly put it, many Shopify themes "decouple visual heading size from semantic HTML level." This means something that looks like an H2 on your page might actually be a So, the first golden rule: always inspect your elements! Right-click the heading text on your live page and select 'Inspect' (or 'Inspect Element'). This will show you the exact HTML tag and any classes or IDs it carries. If it's just Another critical point that Shopplaza_team and Ploqo highlighted was where Mazzah was putting their custom CSS. Mazzah had initially placed the code in a section-specific CSS box. The Shopify editor often has these handy boxes that say "Adds custom styles to this section only." If you want a change to apply across your entire store (or to all H2s, for example), you need to put it in the global Custom CSS area. Our community experts also pointed out some theme-specific nuances for Dwell (which Mazzah was using). Priyasha and Ploqo both noted that Dwell's mobile breakpoint is actually Ploqo also observed that Dwell's H2 is a "flat 2.5rem (40px) at every width, with no mobile step down the way H1 has." This means it truly needs a custom mobile override if you want it to look good on smaller screens. They offered a fantastic solution that covers both the standard The Mazzah was thrilled that Ploqo's solution worked perfectly for their specific element, and it really highlights how crucial it is to understand those little details like selectors and where to place your code. Every problem like this is a learning opportunity, helping us all get a little more comfortable under the hood of our Shopify stores. Huge thanks to Ploqo, Priyasha, shopplaza_team, devcoders, Maximus3, and ashinxavier for their collective wisdom! If you're looking to start your own Shopify store and want to dive into these kinds of customizations, it's a fantastic platform to build on. You can get started with Shopify today and begin your journey into e-commerce, armed with a growing understanding of how to make your store look exactly how you want it..h2 targets an element that has a class named 'h2' (e.g., . If your theme uses the standard H2 tag without a matching class, your .h2 selector won't find anything to style.
tag or a tag that simply doesn't have class="h2" applied to it. Maximus3 further elaborated on this, noting how themes like Dwell/Horizon use "typography presets" where a visual 'H2' might be a using type_preset: "h2".
, then your selector needs to be just h2.
Beyond the Selector: Where Your CSS Lives Matters
Finding the Global Custom CSS Box:


The Dwell Theme Specifics: Breakpoints and Specificity
749px, not the more common 768px. While 768px might still work for some devices, using the theme's native breakpoint ensures consistency.h2 tag and any elements styled with a .h2 class, even catching paragraphs inside the block:@media screen and (max-width: 749px) {
.h2,
.h2 * {
font-size: 22px !important;
}
}!important tag is often necessary to override existing theme styles, especially when the theme's CSS has higher specificity. It's generally a last resort, but sometimes essential for quick fixes like this.Putting It All Together: Your Step-by-Step Fix
) and any classes it has (e.g., class="my-custom-heading").
tag with no specific class, try:
@media only screen and (max-width: 749px) {
h2 {
font-size: 22px !important;
}
}@media screen and (max-width: 749px) {
.h2,
.h2 * {
font-size: 22px !important;
}
}class="product-title-heading"), target that instead:
@media only screen and (max-width: 749px) {
.product-title-heading {
font-size: 22px !important;
}
}749px to your theme's specific mobile breakpoint if different, and 22px to your desired font size.
