cssplant
cssplant

Reputation: 39

(!IE) Problems with Blocking Code from IE

I have (once again) been enhancing my template for a school site. However, I have run into another problem. I have noticed that the navigation bar does not render properly in any Internet Explorer version prior to IE9 (to be expected). I had seen the use of the !IE tag around the web and tried replicating it on my design. However, once implemented, every browser stopped showing that piece of code.

<!--[if !IE]>
    <li><p>&nbsp;&nbsp;</p></li>
    <li><img src="vp-global-logo.gif" />
<![endif]-->

I also tried:

<!--[if gte IE 9]>
    <li><p>&nbsp;&nbsp;</p></li>
    <li><img src="vp-global-logo.gif" />
<![endif]-->

How would I get this to work? Is there any alternative method without making the site too slow?

Upvotes: 0

Views: 96

Answers (2)

BoltClock
BoltClock

Reputation: 724112

You need to terminate the conditional comments with a special syntax:

<!--[if !IE]><!-->
    <li><p>&nbsp;&nbsp;</p></li>
    <li><img src="vp-global-logo.gif" />
<!--<![endif]-->

This prevents IE from displaying the HTML while other browsers get to see it, treating the if and else as regular HTML comments.

Upvotes: 2

Clive
Clive

Reputation: 36955

You're commenting out the list items, try changing your code to this:

<!--[if gte IE 9]--><!-->
    <li><p>&nbsp;&nbsp;</p></li>
    <li><img src="vp-global-logo.gif" />
<!--><![endif]-->

Upvotes: 1

Related Questions