Conditional Comment Query

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I am running XP SP2 on a Windows PC and running the following test code.
It does not display the appropriate line of print when I run it under IE7.
It behaves as expected when I run it under Firefox.
Can anyone please explain this, and or advise where I am going wrong?

 " ">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
body {
margin: 0;
padding: 0;
<!-- [if IE7]>
<p style="font-size:24px; color:red">This is an IE test</p>
<![if !IE]>
<p style="font-size:24px; color:red">This is a non-IE test</p>

Brian Tozer

Re: Conditional Comment Query

Well bust mah britches and call me cheeky, on Thu, 25 Oct 2007 23:35:39
GMT KiwiBrian scribed:

Quoted text here. Click to load it

It should be [if IE 7].  (You have no space.)

Just a boogar in the proboscis of life.

Re: Conditional Comment Query

KiwiBrian wrote:
Quoted text here. Click to load it

Don't need to HTML comment out your CSS, nobody is using a browser that old.

Quoted text here. Click to load it

below code isn't it missing the "--" <!--[if !IE]>

And also since *only* IE recognizes the conventional crap the test "!IE"
  would not be displayed by *any* browser!  IE would recognize it and
evaluate it as false and other browsers will just ignore it an HTML comment.

Quoted text here. Click to load it

Take care,


Site Timeline