Drupal Conditional Styles

  • Print this article

The Drupal content-management platform used for website development offers multiple themes, styles and modules for customizing websites, including the Conditional Stylesheets module This module is designed to work with Conditional Comments, a proprietary Internet Explorer software that makes it easier for developers to customize websites to different browsers.

  1. Conditional Comments

    • One of the standard Web page operations is to identify the browser accessing the page. Conditional Comments offers an alternative to writing a script for browser identification. It enables developers to write pages that fit with Internet Explorer's proprietary features while still displaying correctly on other browsers. Conditional Comments only takes effect under certain circumstances -- Internet Explorer versions older than 5.0 simply ignore them -- which gives Web developers more flexibility.

    Conditional Stylesheets

    • Stylesheets define how a website should display HTML elements. A conditional stylesheet is one that displays different styles in response to users employing different Web browsers. The Drupal Conditional Stylesheets module works with Conditional Comments to create Internet Explorer-conditional styles. Without Conditional Stylesheets, the only way to create conditional styles for that browser involved writing 35 lines of complicated code into the website template. The module does have one drawback, in that it limits the total number of stylesheets used on the site to 31.

    Themes

    • Several established Drupal website themes incorporate Conditional Stylesheets. Zen, a flexible, customizable theme that the Drupal website recommends as "the ultimate starting theme" for Drupal beginners is one. As of the time of publication, Layout Studio and Tendu themes also use Conditional Stylesheets, though more themes may incorporate it eventually. If the theme you favor doesn't have the module built in, you can incorporate it by adding the module's lines of code to your website's .info file.

    Using

    • You can download the Conditional Stylesheets module from Drupal, along with instructions on working the module's coding. More than 7,000 Drupal sites have incorporated the module as of the time of publication. The module works with Drupal 6 and later versions, though there are differences in the syntax you use in Drupal 6 and Drupal 7. if you need to use more than 31 different stylesheets, you can add Drupal's IE CSS Optimizer module, which aggregates the different stylesheets so Internet Explorer can deal with that large a number.

Related Searches

References

Resources

Comments

Related Ads

Featured
View Mobile Site