Search code examples
cssinternet-explorerconditional-comments

Why does IE9 on emulation mode render conditional comments?


I am testing css with conditional comments on internet explorer 9 using emulation mode, however it seems to render the css on screen as text. why is this happening?

enter image description here

<!--[if IE]>
  .path2 {
    font-weight:300;
  } 
<![endif]-->

Solution

  • Because conditional comments are rendered as HTML, not CSS. So if you want styles, you have to add a style tag:

    <!--[if IE]>
      <style type="text/css">
        .path2 {
          font-weight:300;
        } 
      </style>
    <![endif]-->