2

I created a sub theme which is intended to just have a few color changes and background image changes.

The Base theme is called limon. The sub theme is limon_orange. In the sub theme, i have a unique style sheet that I want to use to override the base theme styles via cascade. In the limon_orange.info file I have this line:

stylesheets[all][] = orange.css

The sub theme works, but orange.css is never used. What am I missing? Why is orange.css not loading?

2

Any change in .info does not take effect only by clearing cache. Remember to clear the theme registry. You can do this by just going to the admin/appearance and saving it.

  • Tried this, but didn't work. – Ben Jan 10 '12 at 15:39
  • are you look for the effect or are you looking in firebug to see if the file is being included in the <head> – 15dk51 Jan 10 '12 at 15:42
  • I'm viewing the source. And it is no where to be found in the code. – Ben Jan 10 '12 at 15:45
  • 1
    I tried switching themes with the Theme Switch module I have installed and that made it work. I guess that module keeps things cached that would otherwise be cleared. – Ben Jan 10 '12 at 15:52
0

First, I assume that you do not need a relative path for the stylesheet and Drupal can find the file.

There is a strong chance that your css is being read but is overridden by other style elements. If you use firebug you can see which css files and style inputs are controlling the display. Quite often you might have an element such as a paragraph, header, or link that is attached to several classes. CSS uses a scoring system to determine what style will prevail. The css hierarchy is scored with css info in a 'style' definition highest:

style="" -       1000 points
#Wrapper #ID {} - 200 points
#ID .class {} -   110
div#id {} -       101 
#id -             100
p.class class {}   21
p.class {} -       11
div p {} -          2
p -                 1

(p represents any html type such as h1, a, etc.)

  • I'm viewing the source and my orange.css style sheet is not loaded anywhere. Are you saying that it doesn't actually load but just tack on the rules somewhere in the base theme's style sheets? – Ben Jan 10 '12 at 15:39
  • IF none of your styles are applicable to the content it will not be included in the render for the page. – Ashlar Jan 10 '12 at 15:50
  • Everything that Drupal assembles for a page is held in an array which includes the content and theming information. This arrangement means that only the essential styles are actually included in the themed render array. – Ashlar Jan 10 '12 at 15:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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