Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: Views Bootstrap 5.5.4 — Minor update available for module views_bootstrap (5.5.4). Release: Rightup theme 1.0.3 — Minor update available for theme vartheme_bs5_rightup (1.0.3). Release: CommentOn 1.0.6 — Minor update available for module commenton (1.0.6). Release: ChatGPT Ads 1.0.3 — Minor update available for module chatgpt_ads (1.0.3). Release: Opensolr Search 5.1.3 — Minor update available for module opensolr_search (5.1.3). Release: ServiceM8 Webform Integration 1.2.1 — Minor update available for module servicem8_webform (1.2.1). Release: PostfixAdmin 1.0.0 — Initial release available for module postfix_admin (1.0.0)! Release: ip_analyser 1.0.3 — Minor update available for module ip_analyser (1.0.3). Module Revived: Swagger-PHP OpenAPI 3 documentation generator 1.0.0 — Module swagger_php updated after 10 months of inactivity (1.0.0). Security Coverage: Microsoft Azure AI — Module ai_provider_azure now has official Drupal security advisory coverage.

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 37 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 Drupal 7 themes to easily add conditional stylesheets to the theme's .info file.

; Set the conditional stylesheets that are processed by IE.
stylesheets-conditional[lt IE 7][all][] = ie6-and-below.css
stylesheets-conditional[IE 9][all][] = ie9.css
stylesheets-conditional[IE][print][] = ie-print.css
stylesheets-conditional[(gte IE 9)|(gt IEMobile 7)|(!IE)][all][] = modern-browsers.css

Note: The above syntax is for Drupal 7 themes. See the online documentation for the Drupal 6 syntax.

Placing the above lines in your theme's .info file will automatically append the following HTML code after your existing stylesheets in the <head> 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]-->
<!--[if (gte IE 9)|(gt IEMobile 7)|(!IE)]><!-->
  <link type="text/css" rel="stylesheet" media="all" href="modern-browsers.css" />
<!--<![endif]-->

More information about the .info file syntax used by this module can be found in the documentation. In addition, more information about Conditional Comments is available on Microsoft’s website.

Note that all versions of IE limit the number of stylesheet files to 31. In Drupal 6, this will cause problems if you have a large number of stylesheets; consider aggregating them in the performance settings page, or installing the IE CSS Optimizer module.

What themes make use of the Conditional Stylesheets module?

The following themes have conditional stylesheets included their .info file and make use of the functionality of this module.

But all themes should be compatible with this module if you manually add lines to their .info file.

Drupal 6 version

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

Drupal 8 version

For information about the Drupal 8 version, please read the online documentation.

About the “logo”

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

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
2
Tracked since
Jul 2024
Latest release
2 years ago
Releases (12 mo)
0
Maintenance
Dormant

Releases

Version Type Core Release date
8.x-1.2 Stable Jul 3, 2024
8.x-1.1 Stable Jul 3, 2024