Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

IE conditional comments not working?

Conditional comments for IE 5/5.5 not working.

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

Junior Member

10+ Year Member

joined:Sept 29, 2006
votes: 0


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.


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

Please help if you can



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

Full Member

10+ Year Member

joined:Oct 9, 2002
votes: 0

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)

Junior Member

10+ Year Member

joined:Sept 29, 2006
votes: 0

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)

Preferred Member

10+ Year Member

joined:Aug 17, 2005
votes: 0

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)

Senior Member from US 

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

joined:Oct 17, 2005
votes: 26

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)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Mar 29, 2007
votes: 0

Here's the MSDN page for the comments:

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.