CSS Conditional comments

<!–[if IE 6]>
Special instructions for IE 6 here
<![endif]–>

<!–[if IE]>
According to the conditional comment this is Internet Explorer

<![endif]–>
<!–[if IE 5]>
According to the conditional comment this is Internet Explorer 5

<![endif]–>
<!–[if IE 5.0]>
According to the conditional comment this is Internet Explorer 5.0

<![endif]–>
<!–[if IE 5.5]>
According to the conditional comment this is Internet Explorer 5.5

<![endif]–>
<!–[if IE 6]>
According to the conditional comment this is Internet Explorer 6

<![endif]–>
<!–[if IE 7]>
According to the conditional comment this is Internet Explorer 7

<![endif]–>
<!–[if gte IE 5]>
According to the conditional comment this is Internet Explorer 5 and up

<![endif]–>
<!–[if lt IE 6]>
According to the conditional comment this is Internet Explorer lower than 6

<![endif]–>
<!–[if lte IE 5.5]>
According to the conditional comment this is Internet Explorer lower or equal to 5.5

<![endif]–>
<!–[if gt IE 6]>
According to the conditional comment this is Internet Explorer greater than 6

<![endif]–>

<![if !IE]>
<link rel=”stylesheet” type=”text/css” href=”css/not-ie.css” media=”screen”/>
<![endif]>

<!–[if lt IE 7]><style type=”text/css”>a.menu{height:0;}</style><![endif]–>

#1:
<!--[if IE]>
You are using IE (IE5+ and above).
<![endif]-->

#2:
<![if !IE]>
You are NOT using IE.
<![endif]>


Operators supported by CC
Operator syntax Description
! The "not" operator.
lt The "less than" operator.
lte The "less than or equal to" operator.
gt The "greater than" operator.
gte The "greater than or equal to" operator
With the above operators more generic detection of browsers such as IE6+ (which encompasses IE6, IE6.1, IE7, and so on) becomes possible. For example:
<!--[if gte IE 6]>
You are using IE 6+
<![endif]-->

Leave a Reply

© 2020 Spirituality