Conditional Stylesheets

Slug: 
conditional_styles
Versions de Drupal: 
6.x
7.x
D.o - Installation Rank: 
176
D.o - Reported Installs: 
3 750
D.o - Maintenance Status: 
Actively maintained
D.o - Development Status: 
Under active development
D.o - Module Categories: 
Theme Enhancements
D.o - Download 6.x: 
6.x-1.1|http://ftp.drupal.org/files/projects/conditional_styles-6.x-1.1.tar.gz|8.95 KB
D.o - Download 7.x: 
7.x-2.0|http://ftp.drupal.org/files/projects/conditional_styles-7.x-2.0.tar.gz|8.75 KB
D.o - Original Description: 
Conditional Stylesheets

Internet Explorer implements a proprietary technology called Conditional Comments. While web developers frown upon technologies that aren't cross-browser supported, many CSS developers have found Conditional Comments very useful. They can have cleaner CSS in their normal stylesheets and can fix the broken rendering in IE by placing IE-only CSS inside conditional comments; this technique is even recommended by Microsoft.

Without this module, the only way to have IE conditional stylesheets was to add 35 lines of code (more if you want to add more than one stylesheet) in four horribly-difficult-to-remember function calls to your theme's template.php. Blech. Who wants that?

This module allows themes to easily add conditional stylesheets to the theme's .info file.

; Set the conditional stylesheets that are processed by IE.
conditional-stylesheets[if lt IE 7][all][] = ie6-and-below.css
conditional-stylesheets[if IE 9][all][] = ie9.css
conditional-stylesheets[if IE][print][] = ie-print.css

Placing the above lines in your theme's .info file will automatically append the following HTML code after your existing stylesheets in the of your website:

<!--[if lt IE 7]>
  <link type="text/css" rel="stylesheet" media="all" href="ie6-and-below.css" />
<![endif]-->
<!--[if IE 9]>
  <link type="text/css" rel="stylesheet" media="all" href="ie9.css" />
<![endif]-->
<!--[if IE]>
  <link type="text/css" rel="stylesheet" media="print" href="ie-print.css" />
<![endif]-->

More information about Conditional Comments is available on Microsoft’s website.

What themes make use of the Conditional Stylesheets module?

Drupal 6 version

The above information is about the Drupal 7 version, for information about the Drupal 6 version, please read the online documentation.

About the “logo”

Its a parody of the IE6 logo with our friendly Druplicon.

Souscrire à DrupalFrance.com RSS