Shopify Theme CSS: Fixing Overrides and App Styles
Shopify merchants usually meet CSS problems in one of three ways: a style change that refuses to apply, custom styling that vanishes after a theme update, or a store that has grown slow because every installed app adds its own stylesheet to every page.
All three come from not knowing where Shopify themes keep their CSS, in what order it loads, and who owns each file. This guide maps the places CSS lives in an Online Store 2.0 theme, shows where your own changes should go, and explains how to find and trim stylesheets that apps and old customisations have left behind.
Where CSS lives in a Shopify theme
A Shopify theme is a set of Liquid templates, sections, snippets and assets. Styles can come from at least six places, and a problem is much easier to fix once you know which one a rule came from.
| Location | What it is for | Survives a theme update? |
|---|---|---|
assets/*.css | The theme's main and component stylesheets, for example base.css
and component-card.css in Dawn-based themes | No, if you edit the theme's own files |
layout/theme.liquid | Links to the main stylesheets, plus an inline block that turns theme settings such as colours and fonts into CSS custom properties | No |
{% stylesheet %} tags in sections, blocks and snippets | Component CSS that Shopify gathers into a single stylesheet for the theme | No |
| Theme editor "Custom CSS" fields | Small changes for the whole theme or one section, stored in theme settings | Check after each update; settings are generally carried across, code edits are not |
| App embeds and app blocks | CSS supplied by apps through theme app extensions | Managed by the app |
Older app code and content_for_header | Stylesheets injected by older apps, or snippets they pasted into theme files | Often left behind after the app is removed |
Two practical points follow. First, any change you make directly to the theme's own files is lost when you install a newer version of the theme, because an update gives you a fresh copy of the code. Second, the order these sources load in decides which rule wins when selectors tie, and theme editor custom CSS is designed to load late so that it can override the theme.
layout/theme.liquid and search for stylesheet_tag
and asset_url. That shows you the site-wide stylesheets. Then open a section file such as
sections/main-product.liquid and search again to see the component files loaded only by
that section.Working out which rule is winning
When a change does not show on the storefront, do not keep adding !important. Find out why first:
- Open the storefront, right-click the element and choose Inspect.
- In the Styles pane, look for your rule. If it is missing entirely, the file is not loaded on that page or the selector does not match the element. If it is present but crossed out, another rule is beating it; the winning rule is listed above it with its file name.
- Hover the file name next to each rule to see whether it comes from your file, a theme asset, the compiled section styles or an app domain.
- Check the Network panel filtered to CSS to confirm your file actually loads, with a 200 status, on the template you are testing.
The CSS Checker adds the wider view: it validates the CSS against W3C standards, flags render-blocking and unused rules, reports specificity issues and measures stylesheet size, so you can see whether a store-wide problem such as a heavy app stylesheet sits behind the symptom you noticed.
Common reasons a Shopify override fails
- The rule is in a file that loads before the theme's stylesheet, so an equally specific theme rule later in the cascade wins.
- The theme targets the element with a longer selector, such as
.product__info-container .price--large, and your rule uses a single class. - The style is set by a CSS custom property from theme settings, so changing the property in the editor, or overriding the variable, is the correct fix.
- The browser or CDN is showing a cached file. Shopify versions asset URLs when a file changes, but a hard reload rules this out.
- The rule contains an error, such as a missing brace earlier in the file, which silently drops everything after it.
The fix, step by step
Step 1
Duplicate the live theme before touching code
In the Shopify admin, go to Online Store, then Themes, open the menu next to the
live theme and choose Duplicate. Make every change on the copy and preview it before publishing. If you
work with a developer or locally, use Shopify CLI with shopify theme pull and shopify theme dev
so you can edit files in a proper editor, see changes on a preview address, and keep the theme in version
control.
Step 2
Map every stylesheet the storefront loads
Run the CSS Checker on the home page, a collection page and a product page, then open the Network panel filtered to CSS on each. List every file with its origin: theme assets, compiled section styles, your custom file, or an app domain. Note which load on every page and which only on certain templates. This map shows you what you control, which apps add weight, and where custom rules need to sit in the load order.
Step 3
Move your custom rules into one file you own
Create assets/custom.css and link it in layout/theme.liquid
just after the theme's main stylesheet, using the asset_url and stylesheet_tag
filters. Move rules you or earlier developers added to theme files into it, and restore the theme's own
files. For a few small tweaks the theme editor Custom CSS field is fine, but it has a character limit
and does not accept every at-rule, so larger work belongs in a file.
Step 4
Fix overrides that do not apply
Inspect
the element and compare your rule with the one that wins. First check whether a theme setting or CSS
custom property controls the value, and change that instead. Otherwise match the theme's selector, or
add a class you control to the section, rather than reaching for !important. Because your
file loads after the theme's stylesheet, a rule with equal specificity will win. Retest on mobile, where
themes often apply different rules inside media queries.
Step 5
Deal with CSS left by apps
In Online Store, Themes, Customize, open App embeds and switch off embeds for apps you no longer use. For uninstalled apps that edited theme code directly, search the code editor for the app's name or domain and remove leftover snippets, render tags and stylesheet links, after checking the app's removal instructions. For apps you keep, check their settings for an option to load only on the pages where the app appears.
Step 6
Load section CSS only where the section appears
If you add a custom section, give it its own small stylesheet and load it from
inside the section file, or use a {% stylesheet %} tag, rather than adding its rules to
a site-wide file. Then the styles for a size guide or a lookbook only download on pages that use that
section. Check existing custom sections for large rule sets that were placed in base.css
or theme.liquid and move them the same way.
Step 7
Preview, check and publish
Run
shopify theme check if you use the CLI, since it reports Liquid problems and some performance
issues, then preview the duplicate theme on a phone and a desktop across the home, collection, product
and cart pages. Run the CSS Checker on the preview to confirm fewer or smaller stylesheets and no new
validation errors. Publish the copy, keep the old theme unpublished for a while as a fallback, and note
your changes.
Code you can adapt
Linking your own stylesheet after the theme's
In layout/theme.liquid, find the line that loads the main theme stylesheet and add yours directly after it:
{{ 'base.css' | asset_url | stylesheet_tag }}
{{ 'custom.css' | asset_url | stylesheet_tag }}
Overriding a theme setting rather than fighting it
Many modern themes turn theme editor choices into custom properties. If the theme sets button corners through a variable, override the variable in your file instead of every button rule:
/* assets/custom.css */
:root {
--buttons-radius: 0.25rem;
}
/* A store-specific tweak, scoped with a class you added to the section */
.fernbrook-promo .button {
letter-spacing: 0.04em;
}
Variable names differ from theme to theme, so check the inline block in theme.liquid for the names your theme uses.
Component CSS for a custom section
{% comment %} sections/size-guide.liquid {% endcomment %}
{{ 'section-size-guide.css' | asset_url | stylesheet_tag }}
<div class="size-guide page-width">
...
</div>
Recent versions of the stylesheet_tag filter also accept a preload option,
which Shopify documents for stylesheets needed early on the page. Use it sparingly; preloading everything
cancels the benefit. For deferring non-critical CSS in general, see the render-blocking
CSS guide.
{% stylesheet %} tags, so theme settings
cannot be read there. Put setting-driven values into custom properties from the theme's inline block,
and use those properties in your CSS.Apps, checkout and other areas you cannot fully control
Apps built with theme app extensions add their CSS through app blocks and app embeds, and Shopify
removes those when the app is uninstalled. Older apps sometimes wrote directly into theme files: a snippet
in snippets/, a render tag in theme.liquid, a stylesheet in assets/.
Uninstalling the app does not always remove those, which is why stores that have tried many apps over
the years often load CSS for tools they stopped using long ago.
Some stylesheets arrive through content_for_header, which Shopify outputs in the head
and which you should not edit or remove. If an app's CSS loads there on every page, the fix is in the
app's settings or with its developer.
Checkout is separate from the online store theme. Theme CSS does not style it, and customisation there
goes through Shopify's checkout settings and, on plans that allow it, checkout extensions. Do not expect
changes in custom.css to reach checkout pages.
For speed problems on product pages specifically, the Shopify page speed guide covers images, scripts and apps together. For layout jumps on Shopify stores, see the Shopify layout shift guide.
Edge cases
- Theme updates. When you update a theme from the Theme Store, you get a new copy.
Your
custom.cssand the line that loads it have to be added to the new copy, so keep a short note of both. Theme editor settings, including Custom CSS fields, are generally carried across, but check. - Sass files. Older themes may contain
.scss.liquidfiles. Shopify has deprecated Sass in themes, so compile Sass locally and upload plain CSS rather than relying on the platform to do it. - Page builder apps. Builders that create landing pages often ship their own framework CSS. Check whether it loads only on builder pages or across the store.
- Translations and markets. Longer text in other languages can break layouts designed around English. Test your custom styles with each storefront language you publish.
- Dark colour schemes. Themes with several colour schemes apply them per section. See the dark mode guide for keeping contrast right.
Keeping a Shopify theme tidy
- Keep all hand-written CSS in one or two files you own, with a comment at the top saying what each block is for.
- Never edit a live theme directly; always duplicate first.
- When you uninstall an app, check its removal notes and search the theme for leftovers the same day.
- Re-run the CSS Checker after installing an app or updating the theme, and compare the stylesheet list with your map.
- Keep the theme in version control with Shopify CLI or the GitHub integration, so you can see exactly what changed and when.
1. Where should I add custom CSS in Shopify?
For a handful of small changes, use the Custom CSS field in the theme editor, either under theme settings for the whole store or in an individual section's settings. For anything larger, create your own stylesheet in the assets folder, link it in theme.liquid after the theme's main stylesheet, and keep all your rules there. Avoid editing the theme's own CSS files, because those edits are not carried over when you install a newer version of the theme.
2. Why is my custom CSS not working on Shopify?
Usually because another rule is winning. Inspect the element in your browser and look in the Styles pane: if your rule is crossed out, the rule above it is more specific or loads later. Match or exceed its selector, or change the theme setting or custom property that controls the value. If your rule does not appear at all, the file is not loaded on that template, the selector does not match, or an earlier error in the file is dropping it.
3. Will a theme update remove my CSS changes?
Changes made directly to the theme's code files will not carry across, because updating gives you a fresh copy of the theme code. Settings made in the theme editor, including the Custom CSS fields, are generally carried into the updated theme, but check after each update. Keeping your code changes in a single custom file you own, with a note of the one line that loads it, makes reapplying them after an update a quick job.
4. How do I remove CSS left behind by an uninstalled app?
Start with the app developer's removal instructions, since many list the exact files they added. Then open the code editor, search for the app's name and any domain it used, and look for snippets, render tags and stylesheet links that reference it. Remove them on a duplicate theme, preview the store, and only then publish. Apps built with theme app extensions are removed cleanly by Shopify, so leftovers usually come from older apps that edited theme files directly.
5. Can I use Sass in a Shopify theme?
Shopify has deprecated Sass compilation for themes, so relying on scss.liquid files is not a good long-term approach. Keep Sass on your own machine or in your build, compile it to plain CSS, and upload the output to the assets folder, for example with Shopify CLI. Most of what Sass variables were used for can now be done with CSS custom properties, which can also be set from theme settings in the theme's inline style block.
6. Can I style the Shopify checkout with theme CSS?
No. The checkout is not part of the online store theme, so stylesheets in your theme do not reach it. Its appearance is controlled through Shopify's checkout settings, such as colours, fonts and logo, and on plans that allow it through checkout extensions and branding options. If a guide tells you to add CSS to a checkout template file, it is out of date. Keep theme CSS focused on the storefront, cart page and account pages instead.
7. Why does my Shopify store load so many stylesheets?
Online Store 2.0 themes split their CSS into small component files that load with the sections using them, which is intended and usually efficient. The count grows when apps add their own stylesheets on every page, when old app code stays after uninstalling, and when custom sections put their rules into site-wide files. Map every stylesheet by origin, remove what belongs to apps you no longer use, and load custom section styles only where those sections appear.
The CSS Checker validates your CSS against W3C standards, flags render-blocking and unused rules, scans for specificity issues and prefix gaps, and measures stylesheet size, so you can see what your theme and apps really load.
Open CSS Checker Fixes โ