How can I add my css file as default for the whole Drupal site?

Where to put my CSS file so that it applies to whole Drupal 7 site that I am creating.

2 Answers 2


If you want it on every theme, then you'll want it in a module.

Using this method you won't have to put the CSS in with every theme - just add and enable the module.

Just create a module that uses the following code:

function MYMODULE_preprocess_page($vars) {
  $options = array(
    'group' => CSS_THEME,
    'every_page' => TRUE
  drupal_add_css(drupal_get_path('module', 'MYMODULE') . '/MYGLOBALCSS.css', $options);
  $vars['styles'] = drupal_get_css();



You'll need to clear your theme registry to have the changes picked up.

  • Will it be applicable to whole site......
    – Dharmender
    Jul 2, 2012 at 10:00
  • Yes. So long as the module is active - which it will be regardless of the chosen theme.
    – Chapabu
    Jul 2, 2012 at 11:49

You need to add a stylesheet to your theme folder in a folder named 'css' for example, then in your YOURTHEME.info file you need to make a reference to it like...

stylesheets[all][] = css/default.css
  • That means I have to write in Info file of all themes so that when user changes theme, custom css should also be available.
    – Dharmender
    Jul 2, 2012 at 9:11
  • What you want to do is have a 'base' theme with your default styles then you can create any number of 'sub' themes while retaining the default 'base' theme within them.
    – Alex Gill
    Jul 2, 2012 at 9:14

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.