4

Ideally, if all of the CSS files used should be defined in the theme's .info file, how would I go about using different CSS files for different browsers?

3 Answers 3

5

The Conditional Stylesheets module allows themes to easily add conditional stylesheets to a theme's .info file.

This module is already used by the Zen, Layout Studio, and Tendu themes.

3

Put this in your info file

  ; Set the conditional stylesheets that are processed by IE.
  conditional-stylesheets[if IE][all][]       = css/ie.css
  conditional-stylesheets[if lte IE 6][all][] = css/ie6.css

This is taken directly from the Zen theme for Drupal 6.

4
  • OK thanks, but do I need to download a module in order for this code to work?
    – Jane
    Aug 12, 2011 at 19:47
  • Yes I think you have to download the module to use the above code -- many thanks to both of the people who replied!
    – Jane
    Aug 12, 2011 at 20:16
  • Nope. Just put this code in your theme folder. I suggest you download the Zen theme and make a sub-theme because there is a TON of instructions in the readme.txt files that will explain this for you.
    – nmillin
    Aug 12, 2011 at 20:22
  • The Zen theme is using the Conditional Stylesheets module, as reported in keithm's answer.
    – apaderno
    Mar 1, 2012 at 17:58
1

You could use the CSS Browser Selector module which allows you to write cross-browser CSS using selectors like .ie7, .ie, .ff, .safari, etc.

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.