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?
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.
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.
-
OK thanks, but do I need to download a module in order for this code to work? – Jane Aug 12 '11 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 '11 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 '11 at 20:22
-
The Zen theme is using the Conditional Stylesheets module, as reported in keithm's answer. – kiamlaluno♦ Mar 1 '12 at 17:58
You could use the CSS Browser Selector module which allows you to write cross-browser CSS using selectors like .ie7
, .ie
, .ff
, .safari
, etc.