Search code examples
cssinternet-explorer-7

IE7 conditional CSS comments not working


I have IE8 installed on my Windows 7 machine and I'm using the developer tools to display pages with the IE7 browser mode.

I want to add a conditional stylesheet for IE7 but it's not working. The path is correct, so my guess, at this point, is that the IE7 browser mode doesn't actually render fully as IE7.

       <!--[if IE 7]>
           <link rel="stylesheet" type="text/css" href="http://example.com/media/IE7/ie_splash.css" />
       <![endif]-->

Any thoughts or suggestions?


Solution

  • I've done a quick check on Windows XP and can't replicate this - you could try:

    <html>
    <body>
    
    <!--[if IE 6]>
    I am IE 6
    <![endif]-->
    
    <!--[if IE 7]>
    I am IE 7
    <![endif]-->
    
    <!--[if IE 8]>
    I am IE 8
    <![endif]-->
    
    </body>
    </html>
    

    And see what version it renders in your browser. For me, toggling to IE7 renders "I am IE 7".