Skip to header Skip to main navigation Skip to main content Skip to footer

Main navigation

  • Home
  • Drupal Theming
  • Web Designer In Austin
  • Drupal Development Portfolio (opens in new tab)
  • Blog
  • Videos
  • Contact
Web Designer In Austin
Designing Drupal, Defining Distinction

How to Troubleshoot CSS Issues in Your Drupal Sub-theme: A Comprehensive Guide

Screenshot of Drupal 10 development settings page showing Twig debug options
Alaa Haddad, professional Drupal developer based in Austin, TX   Drupal Care
  8:34 PM CDT, Sat July 26, 2025
Share

Adding custom CSS to a Drupal subtheme can sometimes be challenging. If your changes aren’t appearing as expected, here are some steps you can take to troubleshoot the issue.

1. Ensure CSS is Loading

First, confirm that your CSS file in the subtheme is being properly loaded. You can do this by checking the page source or using the browser's developer tools.

  • Page Source: Right-click on the page and select “View Page Source” to see if your CSS file is included in the <head> section.
  • Developer Tools: Open your browser’s developer tools (usually by pressing F12 or Ctrl+Shift+I) and navigate to the “Network” tab. Refresh the page and look for your CSS file in the list of resources.

2. CSS Specificity

Make sure your CSS selectors are specific enough to override any existing styles. Sometimes, less specific selectors can be overridden by more specific ones or by inline styles.

Example:

body.any-class-attached-to-this-tag {
    width: 600px !important;
}

Using !important should be a last resort. Always aim for specificity over using !important.

3. Check Subtheme Configuration

Ensure your subtheme is set up correctly and the CSS changes are being applied. Sometimes, issues can arise if the subtheme isn’t configured properly. Make sure that:

  • The subtheme is correctly inheriting from its base theme.
  • The CSS file is correctly referenced in the libraries.yml file of the subtheme.

4. Enable Twig Debug

Twig debug must be enabled to provide useful debugging information in your templates. In Drupal 10, you can enable Twig debug through the admin interface:

  1. Navigate to the Development Settings: Go to admin/config/development/settings.
  2. Enable Twig Debug: Check the box to enable Twig debug and save the configuration.

Alternatively, you can enable it manually by following these steps:

  1. Locate your services.yml file: This is typically found in the sites/default directory of your Drupal installation.
  2. Edit the services.yml file: Open the file and find the twig.config section. It should look something like this:
parameters:
  twig.config:
    debug: false
    auto_reload: null
    cache: true
  1. Enable debug mode: Change the debug value to true and the cache value to false:
parameters:
  twig.config:
    debug: true
    auto_reload: true
    cache: false
  1. Clear the cache: After saving your changes, clear the Drupal cache to apply the new settings. You can do this by running the following Drush command:
drush cr

5. Browser Cache

Besides clearing Drupal caches, try clearing your browser’s cache or using an incognito window to ensure you’re seeing the latest changes.

  • Clear Browser Cache: In most browsers, you can clear the cache by accessing the settings or history menu and selecting the option to clear browsing data.
  • Incognito Mode: Open a new incognito or private browsing window to bypass the browser cache.

6. Inspect Elements

Use your browser’s developer tools to inspect the element and see if your CSS is being applied or overridden by other styles.

  • Elements Tab: In the developer tools, navigate to the “Elements” or “Inspector” tab. Select the element you’re trying to style and check the styles pane to see which styles are applied and if any are being overridden.

7. Clear Drupal Cache

Clearing Drupal’s cache is a crucial step after making changes to your theme or CSS files. Use the following Drush command:

drush cr

Alternatively, you can clear the cache from the Drupal admin interface by going to Configuration > Performance > Clear all caches.

8. Verify File Permissions

Ensure that the CSS file and the directories it resides in have the correct permissions. Incorrect permissions can prevent the file from being read by the server.

9. Debugging in Multisite

If you are running a multisite Drupal setup, ensure you are making changes in the correct site directory. Each site will have its own settings and files.

By following these steps, you should be able to troubleshoot and resolve issues with CSS in your Drupal subtheme. If you continue to experience problems, consider reaching out to the Drupal community for further assistance.

Sub-theme

Footer menu

  • About
  • Privacy Policy
  • Terms & Conditions
  • Flash Web Center, LLC (opens in new tab)
  • Drupal Care (opens in new tab)
  • Log in
  • Contact

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

Developed & Designed by Alaa Haddad