Welcome to WebmasterWorld Guest from 54.205.96.97

Forum Moderators: incrediBILL

IE conditional comments not working?

Conditional comments for IE 5/5.5 not working.

   
7:47 pm on Oct 21, 2007 (gmt 0)

5+ Year Member



Hi,

I am trying to create a separate CSS file for IE5 & IE5.5
I have tried to use IE conditional comments with the mark up below but it isn't working. Is this mark up incorrect?
I have taken it from a well respected book so I baffled why it doesn't work.

MARKUP:

<!--[if lt IE 6]>
<STYLE TYPE="text/css">
P {color:blue}
@import ("ie5.css");
</style>
<![endif]-->

Please help if you can

Regards

Erdy

7:53 pm on Oct 21, 2007 (gmt 0)

10+ Year Member



Leave out the "It" so that it's <!--[if IE 6]> and it should work for you.
10:44 pm on Oct 21, 2007 (gmt 0)

5+ Year Member



Hi Edouard_H,

I want to exclude IE6 and only apply rules to IE 5 & 5.5
So surely I don't want to do what you suggest?

The lt is 'less than' isn't it?

10:59 pm on Oct 21, 2007 (gmt 0)

5+ Year Member



Have a look at this thread its in the CSS libray
MS conditional comments [webmasterworld.com]
6:31 pm on Oct 22, 2007 (gmt 0)

WebmasterWorld Senior Member fotiman is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month



@erdy
Looks correct to me. Be aware that this only applies to IE/Win (not IE on the Mac). Also, could it be that you have other styles that are overriding your IE5 styles? For example, if your IE5 styles are included BEFORE your other styles, or if your IE5 styles have a lower specificity.
9:56 pm on Oct 22, 2007 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



Here's the MSDN page for the comments:
[msdn2.microsoft.com...]

It appears you have the syntax correct, I'd have to say same as previous, it may be a CSS conflict.

Try sticking something very obvious but unique in your ie5.css, like:

BODY { border: 10px solid red; }

That shouldn't be defined anywhere else but will certainly stand out if the CSS has been included.

 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month