Search code examples
htmlinternet-explorerhtml5shiv

Conditional Comments Showing up in IE


just a quick (I hope) question regarding conditional html comments in IE...

I'm using the Google shiv/shim to allow HTML5 elements to render correctly in IE8 and less, and the head code looks something like this...

<head>
    <meta charset="utf-8" />
    <title>Rock & Son Restaurant in Manchester</title>
    <link href="/rock-and-son/css/reset.css" type="text/css" rel="stylesheet">
    <link href="/rock-and-son/css/screen.css" type="text/css" rel="stylesheet">
    <!--[if lt IE9]>
        <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
</head>

Great, I thought, when I loaded IE 7/8 and it worked! But then the conditional comment reared it's ugly behind at the top of my browser (in ALL IE versions, including 9). See screenshot:

enter image description here

Does anyone know why this is? I'm at my wits end trying to fathom it out!


Solution

  • I've solved this, it seems you need a space between IE and 9..

    <!--[if lt IE 9]-->