When i add drupal_add_library('system', 'ui.accordion'); to my template.php, 3 jquery css files are loaded, but i can't remove them with $css_to_remove[] = drupal_get_path('misc','ui').'/jquery.ui.core.css'; (i tried some paths, but none worked).

Can anyone tell me how to remove CSS files loaded by jquery libraries? Thanks

2 Answers 2


This code will help you. Add it to your template.php:

function THEME_NAME_css_alter(&$css) {
  // List of disabled drupal default css files.
  $disabled_drupal_css = array(
    // Remove jquery.ui css files.

  // Remove drupal default css files.
  foreach ($css as $key => $item) {
    if (in_array($key, $disabled_drupal_css)) {
      // Remove css and its altered version that can be added by jquety_update.

If you want to remove some other css - just print_r $css variable to get its name and add it to $disabled_drupal_css.

  • Many thanks for your answer, it works perfectly. How is this different from $css_to_remove[] = drupal_get_path('module','ckeditor').'/ckeditor.css';? Jul 31, 2012 at 16:47
  • If you want remove css styles from CKeditor you can add line: $disabled_drupal_css[] = drupal_get_path('module','ckeditor').'/ckeditor.css'; Aug 1, 2012 at 8:00

You have to use exactly the same name as the stylesheet you want to remove.

You could do that even in your theme .info file. The file does not need to exist, it is enough if you just add this line there:

stylesheets[all][] = jquery.ui.core.css

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.