marcamillion
marcamillion

Reputation: 33795

If IE comments showing up in IE9

This is what is happening when you visit my site in IE9 - IE9 Error

This is the code that is causing this:

<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<link rel="stylesheet" href="stylesheets/ie.css" media="screen" />
<![endif]-->
<!--[if !IE]-->
<link rel="stylesheet" href="stylesheets/sizeable.css" media="screen" />
<!--[endif]-->

<!--[if !IE]-->
<link rel="stylesheet" href="stylesheets/sizeable.css" media="screen" />
<!--[endif]-->

Thoughts?

Upvotes: 0

Views: 2837

Answers (4)

Czechnology
Czechnology

Reputation: 15012

EDIT: fixed according to the commenters, thanks. See also the other answers.


Corrected code (second part):

<!--[if !IE]> -->
<link rel="stylesheet" href="stylesheets/sizeable.css" media="screen" />
<!-- <![endif]-->

<!--[if !IE]> -->
<link rel="stylesheet" href="stylesheets/sizeable.css" media="screen" />
<!-- <![endif]-->

Upvotes: 0

user2531551
user2531551

Reputation: 21

<!--<![if (IE X)|(IE Y)]--><link href="../css/style.css" rel="stylesheet" type="text/css" media="all" /><!--<![endif]-->

Above conditional comment will work properly For Hiding Comment line you must have to add <!--<! in this format

Upvotes: 2

zebasz
zebasz

Reputation: 788

Actually, the "dashes" are correct, but first you must close the conditionals, like so:

<!--[if !IE]> -->
<link rel="stylesheet" href="stylesheets/sizeable.css" media="screen" />
<!-- <![endif]-->

<!--[if !IE]> -->
<link rel="stylesheet" href="stylesheets/sizeable.css" media="screen" />
<!-- <![endif]-->

Not adding the "dashes" will cause no browser to pay attention to these conditionals. Non-IE browsers do not read comments, so the code must be outside the comment for the !IE condition.

Upvotes: 3

Xavier Holt
Xavier Holt

Reputation: 14619

You're closing your comments prematurely. Your conditional comments should open like:

<!--[cond]>

and end like:

<![end]-->

You did the first one right, but because your opening tags end with -->, that closes the comment right there, so the link tag, which is supposed to be part of the comment, isn't, and is interpreted as regular HTML.

Hope that helps!

Upvotes: 1

Related Questions