Using a slightly different syntax, it's possible to add conditional comments for non-IE browsers.

Examples:

<!--[if !IE]>
IE8
<![endif]-->

<!--[if !IE]><!-->
Not IE
<!--<![endif]-->

<!--[if (!IE)|(IE 8)]><!-->
Not IE or IE8
<!--<![endif]-->

It should be quite easy to implement by making a small change to the _conditional_styles_theme function:

if ($output) {
  // When targeting non-IE browsers.
  if (stristr($condition, '!IE') !== FALSE) {
    $conditional_styles .= "<!--[$condition]><!-->\n$output<!--<![endif]-->\n";
  }
  // When only targeting IE.
  else {
    $conditional_styles .= "<!--[$condition]>\n$output<![endif]-->\n";
  }
}
CommentFileSizeAuthor
non-ie.patch736 bytesthulstrup

Comments

bc’s picture

subscribing. also, this is useful for defining mobile css rules (media="only screen and (max-width: 480px)" breaks IE).

johnalbin’s picture

Status: Active » Closed (duplicate)