To target not IE with conditional comments.
<!--[if !IE]> -->
According to the conditional comment this is not IE 5-9
<!-- <![endif]-->
And you can do even more advanced stuff: http://www.impressivewebs.com/conditional-comments/
문제
The following code defines if the browser isn't IE execute:
<!--[if !IE]> -->
...
<!-- <![endif]-->
What if I want to edit the above to have...
IF IE but IE version is less than 9 .. SHOW THIS
ELSE IF IE version is greater than or equal to 9 OR Other Browser .. SHOW THIS
How can I achieve it? When searching all I found are how to decide if it's IE versions or not IE at all.
해결책 2
To target not IE with conditional comments.
<!--[if !IE]> -->
According to the conditional comment this is not IE 5-9
<!-- <![endif]-->
And you can do even more advanced stuff: http://www.impressivewebs.com/conditional-comments/
다른 팁
You can use something like this:
<!--[if lt IE 7]> <html class="ie6"> <![endif]-->
<!--[if IE 7]> <html class="ie7"> <![endif]-->
<!--[if IE 8]> <html class="ie8"> <![endif]-->
<!--[if gt IE 8]><!--> <html> <!--<![endif]-->
And then target your selectors by:
.ie8 .your-selector
As described here.
If you want to have a switch you can also at a class to the html-tag, e.g.
<!--[if gt IE 8]><!--> <html class ="i-am-so-happy-it-is-no-ancient-ie"><!--<![endif]-->
and use it like this:
.i-am-so-happy-it-is-no-ancient-ie .your-selector{...}
.ie6 .your-selector {...}
Edit I forgot IE 9.. Acutally Paul Irish suggests to use this form (slightly adjusted by me to make a non ie-switch possible using a single .ie .class - although you have to be aware that ie 6 doesn't support multiple classes, but you get the idea):
<!--[if lt IE 7 ]> <html class="ie6 ie"> <![endif]-->
<!--[if IE 7 ]> <html class="ie7 ie"> <![endif]-->
<!--[if IE 8 ]> <html class="ie8 ie"> <![endif]-->
<!--[if IE 9 ]> <html class="ie9 ie"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html class="no-ie"> <!--<![endif]-->
For an explanation why, see the link above.
you can add the CSS conditional statement for IE browser in HTML page only not in the CSS file..
Target IE 8 and HIGHER
<!--[if gt IE 7]>
<link rel="stylesheet" type="text/css" href="ie8-and-up.css" />
<![endif]-->
<!--[if gte IE 8]>
<link rel="stylesheet" type="text/css" href="ie8-and-up.css" />
<![endif]-->