Skip to header Skip to main navigation Skip to main content Skip to footer
Cookies UI
Alaa Haddad Offers Exceptional Drupal Custom Theming and Modules in Austin TX Alaa Haddad - Drupal Expert
Main navigation
  • Professional Profile
  • Drupal Services
    • Drupal Development
    • Drupal Developer
    • Drupal Themer
    • Drupal Architect
    • Drupal Consultant
  • My Drupal Modules & Themes
      • Cloudflare Purge
      • Solo Copy Blocks
      • W3CSS Paragraphs
      • Paragraphs Bundles
      • Acquia Purge Varnish
      • Reference Blocked Users
      • Module Matrix
      • Paragraphs Bundles Import
      • Selectify
      • Solo Utilities
      • Utilikit
      • Solo
      • Amun
      • Anhur
      • Amunet
      • W3CSS Theme
      • 3D Carousel
      • 3D FlipBox
      • Accordion
      • Carousel
      • Hero
      • Lightbox
      • Parallax
      • Reveal
      • Slideshow
      • Tabs
  • Blog
  • Videos
  • Contact
  • Hire Me (opens in new tab)
Search form
User login
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
  • Reset your password
User account menu
  • Hire Me (opens in new tab)
  • Drupal Services
  • Blog
Site branding
Alaa Haddad - Drupal Expert
Consultant • Architect • Developer • Themer - Expert Drupal Solutions
Article Title Image - Block 1

Drupal Sub-theme CSS Not Working? Six Steps in Order

Content Info - Article Info
 
  10:55 PM CDT, Sun September 13, 2026
Share

Breadcrumbs

Breadcrumb

  • Home
  • Sub-theme
  • Drupal Sub-theme CSS Not Working? Six Steps in Order

Main page content

When CSS in a Drupal sub-theme does not apply, the cause is almost always one of four things — the file never loaded, it loaded in the wrong order, a more specific selector won, or you are looking at a cached copy. Working through them in that order takes about five minutes. Guessing takes an afternoon, and usually ends with an !important that quietly breaks something else six months later.

This is the order I actually use, with the Drupal-specific traps that the generic "clear your cache" advice leaves out.

Step 1: prove the file reached the browser at all

Open DevTools, go to the Network tab, filter to CSS and reload. You are looking for your sub-theme's stylesheet by filename. Two outcomes matter:

  • The file is not in the list. Drupal never attached the library. Skip to step 2.
  • The file is there but returns 404. The library is attached and the path in your .libraries.yml is wrong relative to the theme root. This is the single most common typo, and it is silent — Drupal does not validate that a declared CSS file exists.

Do this before anything else. Half of all "my CSS is not working" tickets end here, and every step below is wasted effort if the file never arrived.

Step 2: is the library attached, and is it attached to this page?

A sub-theme stylesheet reaches a page one of two ways: it is listed under libraries: in the sub-theme's .info.yml, in which case it loads globally, or it is attached conditionally with #attached from a preprocess function or attach_library() in Twig, in which case it loads only where that code runs.

The solo_subtheme starter that ships inside the Solo theme is a minimal worked example of the global case — one library, one CSS file, one JS file, declared in the sub-theme's .info.yml. If you built your sub-theme by hand and skipped the libraries: key, nothing you put in .libraries.yml will ever be requested.

One thing that trips people up on CSS-only changes: the sub-theme also has to be the active theme. Installing it under Appearance is not the same as setting it as default, and a sub-theme that is installed but not default will not contribute a single stylesheet to the front end.

Step 3: it loaded, but something else wins

Select the element in the Elements panel and read the Styles pane from the top: the winner is first, everything struck through lost. Two distinct things can be beating you, and they need different fixes.

Specificity

If the losing rule is your file and the winning rule is a base theme's, and the winner has a longer selector, this is ordinary specificity. Lengthen your selector to match or exceed it — scope it to a body class, a region wrapper, a component class. Reaching for !important here is a decision to lose the next argument too, because the only way to beat an !important is another one.

Load order

If your selector is identical to the one beating it and you still lose, the other file simply loaded later. In Drupal this is not arbitrary: assets are sorted by aggregation group first and only then by weight, and all theme CSS sits in a different, later group from all module CSS. The practical consequence is that a theme's stylesheet always lands after every module's stylesheet regardless of the SMACSS category either of them declared — and inside your own theme, the category you nest a file under changes its weight by up to 400. I have written that mechanism up in full in SMACSS-based CSS categorisation in Drupal theming, because getting it right at the .libraries.yml level removes this entire class of problem permanently.

If you have reached step 4 and the CSS still is not landing, a base theme and a contrib module are probably fighting — that is a themer's hour, and Drupal theming is where it goes.

Step 4: three places CSS can come from in a Solo site

If your sub-theme is built on Solo, there are three separate delivery mechanisms, and confusing them wastes real time because each one appears somewhere different in DevTools.

Where CSS enters the page in a Solo-based sub-theme, and how to spot each one
SourceHow it is deliveredWhere you find it
Sub-theme .libraries.ymlA normal Drupal library, aggregated with the rest of the theme CSSNetwork tab, as a file
Solo's CSS Injector settingAn inline <style> element written into the page headElements panel, on an element with id="solo-css-injector". It will never appear in the Network tab.
Solo's CSS Dynamic settingWritten to a generated file under the public files directory and attached as a libraryNetwork tab, as solo-css-dynamic.css

The CSS Dynamic field carries a trap worth knowing about. Solo only attaches that library if the setting is non-empty and the generated file actually exists on disk. If the public files directory is not writable, the file is never written, the library is never attached, and there is no message on screen — the field just keeps your CSS and nothing happens. Solo does log it, so check Reports → Recent log messages for Failed to save dynamic CSS file. If you pasted CSS into that box and the page did not change, check that the file exists before you check anything else.

The CSS Injector walkthrough shows both fields in the settings form if you want to see where they live.

Step 5: caches, in the right order

Clear Drupal's cache with drush cr, then hard-reload the browser. Do it in that order: clearing the browser first and Drupal second means the browser re-caches the stale aggregate you were trying to get rid of.

For active theming work, turn on Drupal's development settings instead of clearing caches every thirty seconds. On current Drupal core there is an admin page for it at /admin/config/development/settings with a Twig development mode toggle, plus separate checkboxes for Twig debugging output and disabling the Twig cache. That page gives you the same effect as the old services.yml edit without touching a file or remembering to change it back — it stores the settings itself rather than writing the container parameters services.yml sets.

drush cr

That one command is enough. It also resets the query string Drupal appends to aggregated assets, so every browser and CDN in front of your site treats them as new files. You may see drush state:set system.css_js_query_string suggested elsewhere; core reads asset.css_js_query_string, so that command writes a value nothing ever reads.

Step 6: the things that are not CSS problems

  • File permissions. A stylesheet the web server cannot read returns 403, not 404. Read the actual status code rather than assuming.
  • Multisite. Check you edited the theme under the right site directory. The right file in the wrong site directory produces exactly the symptoms of a caching problem, and none of the cache fixes work.
  • Aggregation. Turn it off at Configuration → Development → Performance while debugging, and back on before you finish.

Common questions

Should I edit the base theme's CSS directly instead?

No. The next update overwrites it, and you will not remember what you changed. A sub-theme exists so your changes survive updates; that is the entire point of the pattern. If you are using Solo, its starter sub-theme gives you the correct structure in about a minute.

Is !important ever the right answer?

Occasionally, and only against markup you do not control — an inline style emitted by a contributed module, or a third-party widget. Against your own base theme it is a symptom, not a fix.

How do I know which template produced this markup?

Enable Twig debugging on the development settings page above. Drupal then writes HTML comments naming the template file and every suggestion it considered, directly into the page source.

When to stop debugging and get help

If you have been through all six steps and the cascade still surprises you, the problem is usually architectural rather than a single rule — overlapping libraries, a base theme fighting a contributed module, or a sub-theme that was never quite set up correctly. That is a couple of hours of Drupal theming work, not a week of yours.

If you would rather hand the whole front end over, request a quote and describe what you are fighting with. If you are still choosing a base theme to build on, what the Drupal admin covers and where code starts is the more useful page to read first.

Sub-theme
Slide 1 of 27
Acquia Purge Varnish - API V2 (Drupal Module)
Slide 2 of 27
Amun - W3CSS Sub-Theme (Drupal Theme)
Slide 3 of 27
Amunet - W3CSS Sub-Theme (Drupal Theme)
Slide 4 of 27
Anhur - W3CSS Sub-Theme (Drupal Theme)
Slide 5 of 27
Cloudflare Purge (Drupal Module)
Slide 6 of 27
Module Matrix (Drupal Module)
Slide 7 of 27
Paragraphs Bundles (Drupal Module)
Slide 8 of 27
Paragraphs Bundles Import (Drupal Module)
Slide 9 of 27
Reference Blocked Users (Drupal Module)
Slide 10 of 27
Selectify (Drupal Module)
Slide 11 of 27
Solo (Drupal Theme)
Slide 12 of 27
Solo Copy Blocks (Drupal Module)
Slide 13 of 27
Solo Utilities (Drupal Module)
Slide 14 of 27
Utilikit (Drupal Module)
Slide 15 of 27
Views 3D Carousel (Drupal Module)
Slide 16 of 27
Views 3D FlipBox (Drupal Module)
Slide 17 of 27
Views Accordion (Drupal Module)
Slide 18 of 27
Views Carousel (Drupal Module)
Slide 19 of 27
Views Hero (Drupal Module)
Slide 20 of 27
Views Lightbox (Drupal Module)
Slide 21 of 27
Views Parallax (Drupal Module)
Slide 22 of 27
Views Reveal (Drupal Module)
Slide 23 of 27
Views Slideshow (Drupal Module)
Slide 24 of 27
Views Tabs (Drupal Module)
Slide 25 of 27
VVJ Core (Drupal Module)
Slide 26 of 27
W3CSS Paragraphs (Drupal Module)
Slide 27 of 27
W3CSS Theme (Drupal Theme)
1 of 27

Our mission is to make Drupal more accessible and user-friendly, empowering businesses of all sizes, especially small enterprises with powerful tools that streamline content customization and enhance digital experiences.

Need help with your Drupal project? Hire Me through Flash Web Center, LLC.

Search

The Drupal 11 Module and Theme Stack, With Versions Checked

ARIA Live Regions in Drupal 11: What Core Does, What You Add

Drupal Architect: The Decisions Expensive to Reverse

Drupal Services: Development, Theming, Upgrades | Austin TX

Paragraphs Bundles

Drupal Module - Paragraphs Bundles

Drupal Theme - Solo

Drupal Theme - Solo

Drupal Work List - Drupal Work

Reference Blocked Users (Drupal Module)

Solo Utilities (Drupal Module)

Views Hero (Drupal Module)

Solo (Drupal Theme)

Paragraphs Bundles Import (Drupal Module)

Drupal Theme - W3CSS Theme

Drupal Theme - W3CSS Theme

Drupal Module - W3CSS Paragraphs

Drupal Module - W3CSS Paragraphs

Inspiration

Inspiration is the fuel that powers our creative engine, often coming from our surroundings, experiences, or the works of others. It's that magical moment when something clicks inside your brain, and you suddenly see a path forward that you hadn't noticed before. Inspiration can strike at any time, providing the motivation and energy needed to explore new possibilities and bring your ideas to life.

Unique Ideas

Unique Ideas

Unique ideas are the seeds of innovation, representing original thoughts or concepts that stand out from the usual. They're the sparks that ignite the process of creating something new and different, often leading to unexpected and groundbreaking solutions or products. Whether in art, science, business, or technology, unique ideas challenge the status quo and pave the way for progress.

Brainstorming

Brainstorming

Brainstorming is a creative group activity designed to generate a large number of ideas or solutions to a problem. It's a free-flowing and open-ended discussion where every suggestion is welcomed and considered, no matter how outlandish it may seem. Brainstorming encourages thinking outside the box, fostering an environment where creativity and collaboration lead to innovative solutions.

Planning

Planning

Planning is the blueprint for turning your ideas into reality. It involves setting goals, outlining steps, and organizing resources in a way that makes achieving your objectives possible. Good planning considers potential challenges and opportunities, making it easier to navigate the journey from concept to completion. It's about preparing the groundwork so that your projects can grow and flourish.

Drupal Developer

A Drupal Developer stands as the technical powerhouse behind dynamic websites, wielding expertise in PHP, custom module development, and Drupal's sophisticated API ecosystem. This role transforms business requirements into functional, secure, and scalable web solutions that power everything from small business sites to enterprise platforms serving millions of users. A Drupal Developer's expertise spans the entire development lifecycle—from architecting custom modules and integrating third-party services to optimizing performance and ensuring security compliance. Discover the complete guide to Drupal Developer skills, career paths, and hiring strategies.

Drupal Themer

A Drupal Themer serves as the artistic craftsperson who transforms wireframes and design mockups into pixel-perfect, accessible, and responsive user experiences using Twig templates, CSS, and JavaScript. This specialized role bridges the gap between design vision and technical implementation, ensuring every website not only looks exceptional but performs flawlessly across all devices and meets WCAG accessibility standards. A Drupal Themer's work encompasses the entire front-end ecosystem—from creating custom theme architectures and optimizing Core Web Vitals to implementing complex responsive designs and ensuring seamless integration with Drupal's rendering system. Explore the comprehensive guide to Drupal Themer expertise, theming best practices, and career advancement.

Drupal Architect

A Drupal Architect emerges as the strategic visionary of web construction, armed with encyclopedic knowledge of enterprise architecture patterns, infrastructure design, and Drupal's extensive technological ecosystem. This senior role operates at the highest technical level, making critical decisions that determine whether complex implementations scale successfully or collapse under real-world demands. A Drupal Architect's responsibilities begin long before development starts—during strategic planning phases where the foundation for secure, performant, and maintainable systems is established through careful evaluation of technology stacks, integration strategies, and scalability requirements. Learn about Drupal Architect skills, enterprise architecture strategies, and career progression to principal roles.

Footer menu

  • Contact
  • Professional Resume
  • Resume Summary
  • Technical Skills
  • Privacy Policy
  • Terms & Conditions
  • Search
  • Login
  • Sitemap

Copyright © 2026 Flash Web Center, LLC - All rights reserved

Developed & Designed by Alaa Haddad