Community Documentation

Overriding drupal.css; two approaches

Last updated August 15, 2011. Created by kkaefer on May 19, 2005.
Edited by erdesigns, ronald_istos, divesh.kumar, Dublin Drupaller. Log in to edit this page.

There are two methods to removing drupal.css from your theme in phptemplate.

The first cuts out the link from the $head variable. In page.tpl.php, replace your

<?php
print $head
?>

<?php
print str_replace('<style type="text/css" media="all">@import "misc/drupal.css";</style>', '', $head);
?>

The other method requires overriding the stylesheet import themable function. Simply add this to your theme's template.php file:

<?php
function phptemplate_stylesheet_import($path, $media = 'all') {
  if (
$path != base_path() .'misc/drupal.css') {
    return
'<style type="text/css" media="'. $media .'">@import "'. $path .'";</style>';
  }
}
?>

Replace the leading 'phptemplate' of above function with your theme's name if you are using this code in a plain PHP theme.

About this page

Drupal version
Drupal 6.x
Audience
Designers/themers, Site administrators

Theming Guide

Drupal’s online documentation is © 2000-2013 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.
nobody click here