I would like to make some changes to the core toolbar module across all my sites, and I don't want to modify the actual core's css. It looks like I should be able to override the core css found in modules/toolbar/toolbar.css by simply copying this file into my sites directory at /sites/modules/toolbar/toolbar.css. I tried doing this, cleared the Drupal cache, but nothing happened. What am I missing?

6 Answers 6


Ben Your solution is not ideal, as you now have your own version of the toolbar module, and should there be any bug fixes and security fixes, you will not benefit from those, without upgrading your version of the toolbar module.

Solution 1.

CSS will by it's design overwrite itself, since the theme CSS files will be included last, any rule you make in your theme that is identical to what's in the toolbar will take presedence.

Solution 2.

Sometimes it can be a pain to revert styles to browser default, if that is the case, creating a css file with the same name as the one you want to remove and including it in your theme, will make Drupal skip the one in the module and use the one in your theme. In this case creating a toolbar.css file anywhere in your theme and adding it in your info file, will remove the toolbar.css file from the toolbar module and fix your problems.
Remember to clear cache

Solution 3.

If by some reason you have problems making solution 2 work, you can instead remove the css file using hook_css_alter, this only works in Drupal 7+

  • I don't understand Solution 3. How does removing the default css file help me modify just the styles I need changed across all themes and sites?
    – Ben
    Commented Nov 28, 2011 at 16:52
  • @Ben check the api link, you can more than remove, you can also replace. Also solution 1 can be done in a module by adding the css file in hook_init
    – googletorp
    Commented Nov 28, 2011 at 19:00
  • Unfortunately for me... I know very little PHP and making my own module is way out of my ability. I also looked at the api link you provided and don't see anything about replacing, just removing. But I'm sure you're answer is a good one for those a little more versed in PHP programming. +1
    – Ben
    Commented Nov 29, 2011 at 19:30
  • @Ben if I was you I would go with option 1 and override the css at the theme level as theme css files are loaded at the very end. So if you go with option 1 just open your theme css file and make the changes. Also don't forget to flush your cache bcoz sometimes the changes don't show up with page refresh.Also if you don't want to touch any other files just create a new css file in your theme and add it to the theme info file.
    – junedkazi
    Commented Oct 3, 2012 at 15:44

I am running multiple sites on a single Drupal install, so I need a way to have a single style sheet file I can edit that will be applied to all sites in all themes.

There's two solutions for the multi-site situation you describe:

1) Create a custom module that implements hook_css_alter() to replace core css files with your own css file overrides. Enable this module on all of your sites.

2) Create a "base theme" that essentially does the same thing, but uses the *.info file to override the css files from core. (Technically speaking you could also use hook_css_alter in the theme instead too). All of your sites' respective themes should specify this parent theme as their base theme in their respective info files and those overridden css files from the base theme will be inherited.


There is no need to override the whole file to make changes. You can replace any of the core css settings by entering the specific items into a custom css in your theme folder. It will override the individual settings for that theme. Make certain that the file is identified as a stylesheet in the info file for the theme .

  • I tried this first, but it doesn't quite work the way I want to run my Drupal environment. I am running multiple sites on a single Drupal install, so I need a way to have a single style sheet file I can edit that will be applied to all sites in all themes. At first I thought I could do it by just applying the styles to a modified "Seven" administration theme. This works fine except for when the "Seven" theme is not loaded, when a user is just looking at the pages with the toolbar visible at the top.
    – Ben
    Commented Nov 21, 2011 at 15:27

No need to change the core .php files you should: 1. write the css in your style.css/ example.css file 2. add !important after the property you want to override. for example you want to override font size which is 12px so:font-size:14px !important;

  • 3
    !important should generally be reserved for crucial bits of style that you can't apply with normal selectors. Using it can be problematic as it breaks the cascading-ness of css. Not that you shouldn't use it, but I would generally say if you're having to use it a lot, that's a bad sign. Just worth bearing in mind. Commented Nov 24, 2011 at 9:46

You can simply redefine all the id's and classes's of the CSS in your themes styles.css that you wanna override and remember after defining id's and classes's importantly mention all the property again with your desired value, it won't work only when its defined as '!important' for an instance 'display: block !important;'

Hope this might help you, if any assistance needed in that just drop your comment :)


I did this: http://drupal.org/node/176046

Basically copied the core toolbar directory into the /sites/all/modules directory. Then made the changes I needed. For some reason I had to try this a few times before it actually worked. I don't know if it was due to errors on my part or some extreme server caching.

  • This is not a good solution, check my answer
    – googletorp
    Commented Nov 24, 2011 at 11:56
  • I agree with @googletrop that what I'm doing will prevent the upgrades. But doing any of your three solutions requires me to change every theme. But I will have dozens of sites on this drupal install with several different themes. I need one place to update the styles of the toolbar. I would like to remove everything except the css changes from the /sites/all/modules copy of the Toolbar module and see that work, but last time I tried it, there was no affect. Is there a way to do this that anyone knows of?
    – Ben
    Commented Nov 28, 2011 at 13:59
  • Solution 3 can be implemented in a custom module.
    – googletorp
    Commented Nov 28, 2011 at 14:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.