Mobile Friendly Website

CSSPLAY

Doing it with style

conditional comments COMMENTS

Welcome to my Comments Pages

Please note. I get a few hundred emails a week from visitors asking for help, or posing questions on how to modify my demos to suit their application and I read them all. Unfortunately I only have a limited amount of time to spend answering these questions.

So if I do not reply, please do not be offended, and if I do reply then you are one of the lucky ones.

If you are asking for permission to use any of my demonstration then please email me with your request stu{at}cssplay.co.uk.

Post a comment


Current posts

Julian:-
<!--[if IE 6]-->
You are using EITHER Internet Explorer version 6<br />
OR a non-IE browser
<!--[endif]-->

Ifôve found out, that this will have the same result.
greetings Julian
(10.04.2006, 17:50)

Stu:-
Hi Julian,

I did try that but found that IE6 prints out the --> as well. So i put in <! to get rid of this.
(10.04.2006, 18:09)

Stu:-
It does also work with
<!--[if IE 6] -->
<h1>You are using EITHER Internet Explorer version 6<br />
OR a non-IE browser</h1>
<!--[endif] -->

adding a space between the '[if IE 6]spc-->' and
[endif]spc-->
(10.04.2006, 19:03)

Julian:-
Well you´re right i´m using space in my sourcecode as well
(11.04.2006, 17:09)

Stu:-
Doesn't work with the !IE version though ;o)
(11.04.2006, 17:56)

Stu:-
Sorry Julian, I take it all back. It doesn't work this way.
Try it with [if IE 7] and it will display the text even if it is IE 6.
Whereas
<!--[if IE 7]><!-->
<h1>You are using EITHER Internet Explorer version 7<br />OR a non-IE browser</h1>
<!--<![endif]-->
will not display anything if you are using IE 6.
(11.04.2006, 19:09)

GreLI:-
Microsoft recommends next sequence:
<![if !IE]>
<p>You're not using Internet Explorer.</p>
<![endif]>
(20.05.2006, 20:35)

Stu:-
GreLI, but that's not what I want. I want to INCLUDE IE7 in with the statement NOT exclude ALL IE versions. My way targets IE7 AND all other non-IE browsers.
(21.05.2006, 17:21)

GreLI:-
I think you can use <![if gte IE 7]> same way. But your way is more standarts compliant than microsoft. :)
(09.06.2006, 13:46)

Stu:-
GrelI,
<![if !IE]>
<p>You're not using Internet Explorer.</p>
<![endif]>
Will not be recognised by IE and will also not be recognised by any other browser because it uses Microsoft IE only conditional comments.
(18.08.2006, 15:41)

Greg:-
I found that FrontPage does not like many of these conditional forms. Although they work in the browser parts of them (particularily the endifs) appear greyed out in FrontPage as if they were comments. The result is that FrontPage cannot parse the document properly.

The following works:

<!--[if IE]>
<![if lt IE 7]>
<p>Is IE But a Version Lower Than 7</p>
<![endif]>
<![if IE 7]>
<p>Is IE 7</p>
<![endif]>
<![endif]-->
<!--[if !IE]><!-->
<p>Is Not IE</p>
<![endif]-->
<!--[if IE 7]><!-->
<p>Is Not IE or Is IE 7</p>
<![endif]-->
(29.09.2006, 21:00)

Joost de Valk:-
Hey guys, perhaps this article onwww.joostdevalk.nl/code/conditional-comments.html conditional comments helps?
(05.04.2007, 20:28)

Joost de Valk:-
hehe oops, this article: www.joostdevalk.nl/code/conditional-comments.html
(05.04.2007, 20:29)

Shaun R:-
I know this is an older page but it comes up high in the google search results. I have found a terrible bug in testing for IE6 stylesheets.

On my windows testing machine, I have every version of IE installed. I have just recently installed IE8 and unfortunately it somehow breaks the conditional comments for IE6.

Example:

<!--[if lt IE 7]>
ie6andbelow.css
<![endif]-->

Will NOT work for IE6 once you install IE8.

however, when you use

<!--[if gte IE 7]>
ie7andup.css
<![endif]-->

it WILL trigger in IE6. This is TERRIBLE! that means that you can no longer target IE6 separately from IE7 as the IE7 stylesheet is also applied to the IE6

The only way around this I can figure out is to have a testing machine that does not have IE8 installed at all. It seems like IE6 specific css works as it should in this manner.

I have come across other people saying the same thing in forums but no specific blog entries on any other sites. Any idea why this is happening? it has completely ruined my perfect testing environment.
(24.04.2009, 18:18)

Stu:-
Having IE6 standalone on a PC running a lter version of IE will have the effect that IE6 thinks it is the later version when it sees a conditional comment. This applies to IE6 on a PC running IE7 as well as on a PC running IE8.
The only ways to test are to have a PC running IE6 alone or use a virtual PC running a virtual IE6 (not sure if this is still possible).
(24.04.2009, 19:28)

Omar Cisneros:-
TYVM for share your knowledge with us!
(29.12.2010, 08:04)



Post

Your comment:

Your Name:

Stu's First Name - 3 letters (required)

Thanks to Alex for this script.

Please enter your comments for this site page.
Please note that all posts are moderated.

Posting rules

HTML is turned off
Maximum word length is 80 characters.
Messages limited to 1200 characters.
Web links should not include 'http://'

Support CSSPLAY

Your donations keep CSS PLAY running.
If your donation is for the use of a demo then please email me with the demo url after making your donation.


CUSTOM SEARCH

Facebook Twitter rss feed Facebook Fan Page