Link to home
Start Free TrialLog in
Avatar of jeremyBass26
jeremyBass26Flag for United States of America

asked on

Conditional comments

Hello, I'm looking for a complete list of these... but more to the point i need to know what this conditional comment would be:

if IE 7 and !IE

I think I'd be made up of:
<!--[if IE]><![if !IE]><![endif]-->
For FF and all non-MSIE
<!--[if IE]><![endif]><![endif]-->

<!--[if  IE 7]>
IE 7 only
<![endif]-->

how would you combine them?






the list as of yet:
<p><!--[if IE]>
According to the conditional comment this is Internet Explorer<br />
<![endif]-->
<!--[if IE 5]>
According to the conditional comment this is Internet Explorer 5<br />
<![endif]-->
<!--[if IE 5.0]>
According to the conditional comment this is Internet Explorer 5.0<br />
<![endif]-->
<!--[if IE 5.5]>
According to the conditional comment this is Internet Explorer 5.5<br />
<![endif]-->
<!--[if IE 6]>
According to the conditional comment this is Internet Explorer 6<br />
<![endif]-->
<!--[if IE 7]>
According to the conditional comment this is Internet Explorer 7<br />
<![endif]-->
<!--[if gte IE 5]>
According to the conditional comment this is Internet Explorer 5 and up<br />
<![endif]-->
<!--[if lt IE 6]>
According to the conditional comment this is Internet Explorer lower than 6<br />
<![endif]-->
<!--[if lte IE 5.5]>
According to the conditional comment this is Internet Explorer lower or equal to 5.5<br />
<![endif]-->
<!--[if gt IE 6]>
According to the conditional comment this is Internet Explorer greater than 6<br />
<![endif]-->
</p>
Avatar of Jagadeesh M
Jagadeesh M
Flag of United States of America image

You can also use AND ( & ) , OR ( | ), sub-expression and NOT ( ! ) operators as shown below -


[if (IE 6)|(IE 7)] - The OR operator. Returns true if any of the subexpressions evaluates to true.

[if !(IE 7)] - Subexpression operators. Used in conjunction with boolean operators to create more complex expressions.

[if (gt IE 5)&(lt IE 7)] - The AND operator. Returns true if all subexpressions evaluate to true

![if !IE] - The NOT operator. This is placed immediately in front of the feature, operator, or subexpression to reverse the Boolean meaning of the expression.



You can also use boolean true or false as shown below -

[if true] - Always evaluates to true.

[if false] - Always evaluates to false.


In general this all what is possible -

downlevel-revealed   ->  <![if expression]>
                           html
                         <![endif]>
downlevel-hidden     ->  <!--[if expression ]>
                           html
                         <![endif]-->
expression           ->  term
expression           ->  expression | term
term                 ->  value
term                 ->  term & value
value                ->  true
value                ->  false
value                ->  !value
value                ->  (expression)
value                ->  comparison
comparison           ->  feature
comparison           ->  feature version
comparison           ->  lt feature version
comparison           ->  lte feature version
comparison           ->  gt feature version
comparison           ->  lte feature version
feature              ->  [A-Za-z][A-Za-z0-9]*
version              ->  [0-9][A-Za-z0-9.]*


SOURCE:

http://msdn.microsoft.com/en-us/library/ms537512.aspx
http://msdn.microsoft.com/en-us/library/bb263988(VS.85).aspx
Avatar of jeremyBass26

ASKER

hello, and thanks for the hehlp... but how would you form

if IE 7 and !IE
sorry...can you make your question more clear? What are you trying to say in the conditional statement?


if it is IE 7 and  not IE show HTML

these do it each by them self

For FF and all non-MSIE
<!--[if IE]><![if !IE]><![endif]-->
HTML
<!--[if IE]><![endif]><![endif]-->

IE 7 only
<!--[if IE 7]>
HTML
<![endif]-->

but I want them combined...  It'd be really handy cause most of the time if it is good for IE7 it's good for FF but not good for IE6


side not: could you explane
downlevel-hidden
downlevel-revealed

I don't remeber it being inthe MSDN but it's been a while since i read it too lol...

Thanks for the help
do you realize ...when you say IE it includes IE7 also?
well yes...
but it'd be like


<!--[if IE]><![if !IE]><![endif]--> | <!--[if IE 7]>
HTML
<![endif]--><!--[if IE]><![endif]><![endif]-->

I guess I should have wrote
if it is IE 7 "or"  not IE show HTML
ASKER CERTIFIED SOLUTION
Avatar of David S.
David S.
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
well no but is what i wrote ok?... i was not able to test it... but i didn't think it would lol... good point on IE8..
nevermind... i got you now... I'll be back ...Thanks
jeremyBass
I had to test first but great... Thanks for the help on this...
hmm.....i thought the question was to just find out all possible combinations....and then peeked in to your problem !!!
No It is, that why the I'll be back... sorry... I guess I should have said I'd be back with the list i have so far... :) I have a project to finish tonight but I will be back with alist... please feel free to add anything you can think of... I think it'd be good for everyone it concerns to have a better list then what is out there... Talk with you later :)