Search code examples
htmlcsssafariconditional-commentssafari6

Safari 6 not calculating <!--[if !IE]> conditionals


Am I doing something incorrect here? I have !ie conditionals, however it seems that Safari 6 (not below) is not calculating these anymore. Has anyone experienced this?

my block:

<!--[if !IE]>
<style type="text/css">
  /* styles */
</style>
<![endif]-->

Solution

  • You need to enclose the conditional statements in their own comments using this syntax:

    <!--[if !IE]><!-->
    <style type="text/css">
      /* styles */
    </style>
    <!--<![endif]-->
    

    Otherwise the whole thing will be treated as one giant comment block, and that should happen in any version of Safari, not just 6. See this question and its answers for details.