Hi,

I'm working on a site where the CSS files have not been edited at all in recent months, but simply visiting the themes admin page on the backend seems to have caused a change in how Drupal handles the CSS.

The site's default theme is a subtheme, and it imports some CSS from the theme in which it resides using statements like this...

@import "../layout.css";
@import "../icons.css";
@import "../style.css";

The style.css referenced in that third import statement has some classes that, prior to Friday, were overridden by the style.css in the subtheme. But when I visited the themes admin page on Friday, the classes in the subtheme stopped overriding the classes in the imported style.css. As a result, the styling of the site has changed dramatically, and some HTML elements now display more than one background image. That is, they display the background image specified by the subtheme's CSS, but they also display a background image specified by style.css in the top-level theme.

Any idea what has happened and how to fix?

This site is running Drupal 5.6.

-Ryan

Comments

hferree’s picture

Well, I haven't done much with subthemes, but I just created a theme where the old theme folder overrode the new css and created errors like having a different background than it should as well as other oddities. The only solution i found was to rename the css file so that it would stop overriding the new css. Still not sure why that occurred, but it worked.

Here's what I would do:

1) make sure your browser and site cache (use devel module...panels has a simplecache that can cause your site to do some weird things) are empty.

2) enable another theme and see if you still get the problem

3) try renaming the overriding css and see if you still get the problem.
3a) you can always rename your style.css and link to it in your page.tpl.php.

4) use firefox's firebug and see what css is doing. (You can also use !important in the css to make sure the lines that you want are overriding the others.)

5) if none of those worked, were there any changes to the database that you made Friday? ex: I had one where I had setup the panels where Drupal didn't like it and the next day the site wouldn't work. So I did an override in the setup.php, changed the theme so I could get into the pages, and then deleted that page and the site was happy again. I went back to my theme and redid the evil page.

Good luck.

webcomm’s picture

I still don't know what the problem was, but the theme is now fixed. I don't know how I fixed it, but some of the things I was doing around the time that it started working again include...

(1) renaming the style.css in the subtheme to style2.css and then visiting the site (and/or visiting the themes admin page and/or clicking save on the themes admin page) and then changing the name back to style.css and then visiting the site again;
(2) adding a page.tpl.php to the subtheme, visiting the site, and then deleting page.tpl.php from the subtheme and then visiting the site again

hferree’s picture

Glad its working for you.

CorpSlave’s picture

In my (short) experience, most weird things happen because the cache still contains old stuff. I've made it a habit to clear it any time I mess with any of the code. It has cut back on the amount of un-coding I've had to do.

hferree’s picture

I can't tell you how many times I would have cried if emptying the cache wasn't always my first step. I really got a headache when drupal started cacheing (only one page which made it more confusing) because panel's simplecache got enabled. A friend had to recommend the devel module. Luckily one install and a click later it was all working...

webcomm’s picture

Emptying the cache had no effect in this case. That was one of the first things I tried. : )

But as noted, it fixed itself some other way... who knows how. It's an old version of Drupal (D5), so I'm not concerned.