I'm using Omega3 and having just a couple styling issues with IE. (The site looks good in every other browser) Is there a simple way to detect IE and call an IE specific style sheet to fix these couple layout issues?

I've tried setting/unsetting css/js aggregation and clearing caches. Also tried adding this code to my template.php file and creating a ie8.css file:

drupal_add_css(path_to_theme() . '/css/ie8.css', array('weight' => 999, 'browsers' => array('!IE' => FALSE, 'IE' => '(lt IE 9)&(!IEMobile)'), 'group' => CSS_THEME));

I'm looking for a simple way to detect IE and add a couple lines of css. Thanks!

1 Answer 1

  1. Arguably the simplest (and least Drupal'y) way:

    In html.tpl.php:

    <!--[if lt IE 8]>
    <link rel="stylesheet" href="<?php print base_path() . path_to_theme(); ?>/css/ie7.css" type="text/css" media="all" />

    Clear your theme cache if adding the template to your theme for the first time.

  2. Install the module, Conditional Stylesheets, which allows you to add conditional stylesheets to a theme's .info file.

  3. Add 37 lines of code to template.php.

New to StackExchange, hope I did the right thing here. Thanks, @jdu.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.